God laid His hands on Egypt in divine judgment by sending plagues. When trying a blasphemer, each witness placed his hands upon the guilty person to signify his acceptance of the verdict. Conversely, when a victim was spared death—as when God commanded Abraham not to sacrifice Isaac or when He allowed the leaders of Israel to see Him without dying—mercy is described as hands not being laid on the spared victim.
Martin G. Collins
Basic Doctrines: The Laying On of Hands
Deuteronomy 13:6-11 is clear that, if someone tried to draw another person away from God and entice him to serve other gods, the penalty was death. Whole cities could be destroyed for this (verses 12-18). The same principle is at work with the Canaanites, just on a much larger scale. Being stronger and more numerous than Israel (Numbers 13:31; Deuteronomy 9:1; 20:1), it required an entire army to enforce God's law rather than just a local judge or magistrate. Every able-bodied, non-Levite above the age of 20 had to participate in carrying out God's justice in the land He had given them.
This action was not at all synonymous with a man murdering another because of the evil intent of his heart. It is about God executing wrath on evildoers, commissioning Israel to be the governing authority to carry out His justice. This is not to say that Israel was above reproach—far from it. Israel was simply the tool God used to carry out His law.
God did not tell Israel to wage war on the idolaters beyond their borders. He did not tell them to take the army back to Egypt and “finish the job” or to march on Babylon or Assyria and wipe them out, even though those nations were great idolaters, too. Rather, He told them to carry out His law within the borders that He had set. Due to the size of the job, an army was required. God's command to Israel to go to war was to enforce God's law, not because there is any variableness in Him!
David C. Grabbe
Why Did God Command Israel to Go to War?