A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
deu 20:1THE PRIESTS' EXHORTATION TO ENCOURAGE THE PEOPLE TO BATTLE. (Deu. 20:1-20)
When thou goest out to battle against thine enemies--In the approaching invasion of Canaan, or in any just and defensive war, the Israelites had reason to expect the presence and favor of God.
deu 20:2when ye are come nigh unto the battle, that the priest shall approach and speak unto the people--Jewish writers say that there was a war priest appointed by a special ceremonial to attend the army. It was natural that the solemn objects and motives of religion should have been applied to animate patriotism, and so give additional impulse to valor; other people have done this. But in the case of Israel, the regular attendance of a priest on the battlefield was in accordance with their theocratic government, in which everything was done directly by God through His delegated ministers. It was the province of this priest to sound the trumpets (Num 10:9; Num 31:6), and he had others under him who repeated at the head of each battalion the exhortations which he addressed to the warriors in general. The speech (Deu 20:3-4) is marked by a brevity and expressiveness admirably suited to the occasion, namely, when the men were drawn up in line.
deu 20:4your God is he that goeth with you, to fight for you against your enemies, to save you--According to Jewish writers, the ark was always taken into the field of combat. But there is no evidence of this in the sacred history; and it must have been a sufficient ground of encouragement to be assured that God was on their side.
deu 20:5And the officers shall speak unto the people--literally, Shoterim, who are called "scribes" or "overseers" (Exo 5:6). They might be keepers of the muster-roll, or perhaps rather military heralds, whose duty it was to announce the orders of the generals (Ch2 26:11). This proclamation (Deu 20:5-8) must have been made previous to the priest's address, as great disorder and inconvenience must have been occasioned if the serried ranks were broken by the departure of those to whom the privilege was granted. Four grounds of exemption are expressly mentioned: (1) The dedication of a new house, which, as in all Oriental countries still, was an important event, and celebrated by festive and religious ceremonies (Neh 12:27); exemption for a year. (2) The planting of a vineyard. The fruit of the first three years being declared unfit for use, and the first-fruits producible on the fourth, the exemption in this case lasted at least four years. (3) The betrothal of a wife, which was always a considerable time before marriage. It was deemed a great hardship to leave a house unfinished, a new property half cultivated, and a recently contracted marriage; and the exemptions allowed in these cases were founded on the principle that a man's heart being deeply engrossed by something at a distance, he would not be very enthusiastic in the public service. (4) The ground of exemption was cowardice. From the composition of the Israelitish army, which was an irregular militia, all above twenty years being liable to serve, many totally unfit for war must have been called to the field; and it was therefore a prudential arrangement to rid the army of such unwarlike elements--persons who could render no efficient service, and the contagion of whose craven spirit might lead to panic and defeat.
deu 20:9they shall make captains of the armies to lead the people--When the exempted parties have withdrawn, the combatants shall be ranged in order of battle.
deu 20:10When thou comest nigh unto a city to fight against it, then proclaim peace unto it--An important principle is here introduced into the war law of Israel regarding the people they fought against and the cities they besieged. With "the cities of those people which God doth give thee" in Canaan, it was to be a war of utter extermination (Deu 20:17-18). But when on a just occasion, they went against other nations, they were first to make a proclamation of peace, which if allowed by a surrender, the people would become dependent [Deu 20:11], and in the relation of tributaries the conquered nations would receive the highest blessings from alliance with the chosen people; they would be brought to the knowledge of Israel's God and of Israel's worship, as well as a participation of Israel's privileges. But if the besieged city refused to capitulate and be taken, a universal massacre was to be made of the males while the women and children were to be preserved and kindly treated (Deu 20:13-14). By this means a provision was made for a friendly and useful connection being established between the captors and the captives; and Israel, even through her conquests, would prove a blessing to the nations.
deu 20:19thou shalt not destroy the trees thereof by forcing an axe against them--In a protracted siege, wood would be required for various purposes, both for military works and for fuel. But fruit-bearing trees were to be carefully spared; and, indeed, in warm countries like India, where the people live much more on fruit than we do, the destruction of a fruit tree is considered a sort of sacrilege.
deu 20:20thou shalt build bulwarks against the city that maketh war with thee--It is evident that some sort of military engines were intended; and accordingly we know, that in Egypt, where the Israelites learned their military tactics, the method of conducting a siege was by throwing up banks, and making advances with movable towers, or with the testudo [WILKINSON].