"Will you sweep away the righteous with the wicked? What if there are fifty righteous people in the city? Will you really sweep it away and not spare the place for the sake of the fifty righteous people in it? Far be it from you to do such a thing - to kill the righteous with the wicked, treating the righteous and wicked alike. Far be it from you! Will not the Judge of all the earth do right?"
- Abraham (Gen 18:23-25)
Why were the cities destroyed?
What about innocent adults?
What about the children?
Couldn't the children have died painlessly?
Were the Israelites right to obey God's orders?
How did the Israelites know it was God's command?
Were the Israelites merely justifying their aggression/xenophobia?
Can genocide be justified today?
Why were the cities destroyed?
The primary reason was punishment for wrongdoing. The populations of the destroyed cities had long histories of grievous sins (Gen 15:16, Dt 25:17-19), which often included sacrificing their children to false gods (Dt 12:29-31). Their consciences should have told these people they were doing wrong. Had they listened and changed their ways, they would not have been destroyed. God has said that if any nation is about to be destroyed as punishment but repents, he will forgive them and not destroy them [Jer 18:7-8]. In fact, this occurred in the city of Ninevah (Jonah 3:4-10).
In the cities that were given to the Israelites as their inheritance, there was a secondary reason: totally depraved cultures were destroyed so that they would not corrupt the Israelites into committing the same evil acts [Dt 7:1-4, 20:16-18]. This did in fact occur: when the Israelites didn't obey God and destroy cities, they too began practicing child sacrifice (Ps 106:34-40).
Additionally, the destruction of wicked nations served as an instructive warning to contemporaries (Josh 2:1-11) and future generations (1 Cor 10:1-11).
What about innocent adults?
Sadly, these were few and far between. If people grow up in a culture that accepts things like murder and rape, very few will listen to their conscience and go against what everyone else says. Children learn wrong things from their parents and the surrounding culture; as they mature, they become part of the culture and perpetuate it by participating in it and passing on its teachings to their children.
However, those who were righteous were spared from the destruction. In the destruction of Jericho, Rahab and her family were spared because she feared God and chose to help the Israelites (Josh 2:1-21, 6:22-25). Before the Amalekites were destroyed, their righteous neighbors were warned to move away (1 Sam 15:5-6). God promised not to destroy Sodom if there were but ten righteous people in the city (Gen 18:22-32), and in a later judgment against Jerusalem, promised to forgive the city if one righteous person was found in it (Jer 5:1).
What about the children?
Small children did not share the guilt of their parents. The Bible describes small children as not knowing right from wrong (Is 7:15-16), and in some cases, this meant that they were spared the earthly punishment their elders received. For example, when the Israelites sinned during their wanderings in the desert, God forbid the adults from entering the promised land, but gave it to their children who were too young to be held responsible (Dt 1:34-39). The Bible also clearly teaches that one person is not held guilty for another's sin [Ezek 18]. Therefore, the children who were killed would not face the same punishment in the afterlife as their parents.
Why were the children killed, if they weren't guilty? Apparently, they were considered as morally neutral, since they weren't yet old enough to be held accountable or to have done much right or wrong. While not as corrupt as their parents, they were part of the society that was judged, and shared its earthly (though not its eternal) fate. (Conversely, the family of a righteous person sometimes shared their relative's protection from earthly destruction; see Josh 6:22-25, Gen 19:12-13.) Often, when someone did something wrong and was punished while on earth, only the evildoer themselves was punished. However, when a person or a society committed massive evil, that evil was punished by the destruction of the entire family or city; in such cases, only those who had actively demonstrated their integrity could be saved (14:13-20). See also Does God punish children for their parents' sins?
Couldn't the children have died painlessly?
Why didn't God translate the children into heaven instead of having them die by the sword? Since the children lived in a world affected by sin, they faced its earthly consequences (Rom 5:12-14). Only a few righteous people were translated into heaven, namely Enoch (Gen 5:24, Heb 11:5) and Elijah (2 Ki 2:11). As noted above, since the children had not shown themselves to be righteous, they were not spared the common fate of death.
It's worth noting that being killed with a sword (perhaps beheaded) was at the time one of the quickest ways for the children to die (as opposed to suffocation/strangulation, starvation, disease or being torn apart by wild animals - see Ex 23:28-29).
Were the Israelites right to obey God's orders?
The Israelites personally knew God to be just, righteous and wise. Aside from knowing God through prayer and individual devotions, many generations of Israelites personally witnessed God's miracles. The generation that fought against the Midianites was the generation that had miraculously escaped from Egypt; the generation that fought the wars in the book of Joshua was only one generation later, and saw the parting of the Jordan River (Josh 3:7-17). Both generations experienced God's provision for them during the Exodus (Dt 29:5; manna was provided until the time of Joshua - Josh 5:12). Finally, Moses explicitly taught the Israelites that God "is the Rock, his works are perfect, and all his ways are just. A faithful God who does no wrong, upright and just is he" (Dt 32:4). These things gave them reason to trust God even when he commanded them to do something they might otherwise refuse to do. Furthermore, they understood that God has the authority to destroy a city, and that the best thing for them to do was to trust someone whose judgment and wisdom are far superior to their own. For more on this, see Is it right to obey God? and God's moral authority.
Some have argued that the Israelites should have decided that God's command was wrong and refused to carry it out. It is worth noting that God is unchanging (Mal 3:6), so the Israelites would have known that the just and righteous God they knew before was still just and righteous when he issued the command. However, let us suppose for the sake of argument that God could have issued an unjust command; for instance, ordering the Israelites to be sadistic by torturing babies and enjoying their pain. Sadism is inherently evil; there is no possible situation in which it could be right to take pleasure in torturing others. (The Israelites slew people with swords, which would have been one of the quickest ways at the time to kill someone, and were never told to enjoy killing; thus God's commanded genocide was not sadism.) Therefore the Israelites would have been justified in refusing to practice sadism. Killing a person, while often wrong, is not wrong in all situations; for example, it can be justified if necessary for self-defense. That is, it's not automatically wrong for God to issue an order to kill humans. Since the Israelites had good reason to believe in God's moral perfection, omniscience and omnipotence, the best choice for them would be to trust that God had a better understanding than they of the situation itself and the moral rules governing it. The only way for them to be justified in not obeying God's command would be if the command were inherently evil and impossible to justify (though it must be cautioned that humans with their imperfect understanding could incorrectly decide a command was inherently evil).
How did the Israelites know it was God's command?
Some people have objected that the Israelites didn't directly receive a command from God, but were following their leader's orders, and thus they didn't know if God himself had commanded it or not. It's true that God gave the commands to the leaders of the Israelites, but in all the cases where the Israelites were told by a leader to destroy a population, they had plenty of prior evidence that the leader was in fact anointed by God and could be trusted to deliver God's commands. The three leaders who passed on these commands were Moses, Joshua, and Samuel. The Israelites literally saw for themselves that God spoke with Moses (Ex 33:7-11, 34:29-35), plus they had seen all the miracles that he performed. Joshua was chosen to succeed Moses, and God performed the miracle of the crossing of the Jordan explictly so that the Israelites would know that God was with Joshua (Josh 3:7-17). (After Joshua's death, God spoke to the Israelites directly - see Judges 1:1-2.) And as for Samuel, "all Israel from Dan to Beersheba recognized that Samuel was attested as a prophet of the Lord" (1 Sam 3:20).
Were the Israelites merely justifying their aggression/xenophobia?
When the Israelites destroyed a population, they were acting as God's tools, not taking matters into their own hands. God made it clear to them that he was the one behind their victories (Jdg 7:2-3, Josh 5:13-14). In many cases, the nations were defeated by miracles of God (Josh 6, 10:8-14), and in all cases the Israelites were victorious only because they were following God, who gave them the victory (Josh 10:42).
Furthermore, God told the Israelites in Deuteronomy 9:1-6, "It is not because of your righteousness or your integrity that you are going in to take possession of their land; but on account of the wickedness of these nations." He had also given them several laws concerning treatment of Gentiles/foreigners, including, "When an alien lives with you in your land, do not mistreat him. The alien living with you must be treated as one of your native-born. Love him as yourself, for you were aliens in Egypt" (Lev 19:33-34). (For more on this, see Exclusion of Gentiles in the Old Testament.) Only nations that were guilty of great wickedness were to be destroyed; the Israelites were instructed to first offer peaceful terms to other cities they attacked, and to only kill the men if they ended up going to war (Dt 20:10-15).
God held the Israelites accountable for their sins also. When they sinned, they were unable to win any battles (Josh 7:1-12). When they later fell into the same evil acts that the punished nations had committed, Jerusalem was beseiged and its inhabitants died or were exiled (see the article on Jeremiah).
Can the genocide in the OT be used to justify genocide or mass destruction today?
Genocide, murder or any killing that is not necessary to defend another person's life is not justified. God alone has the right to take human life in cases other than defense. The only reason the Israelites were right to destroy cities in the OT is because they received a clear, direct command from God to do so. Any reason short of that, including humans deciding on their own that God wants them to kill others, is not enough to justify it.
http://www.rationalchristianity.net/genocide.html
The Bible Guild
What if Jesus meant every word He said?