> Source for this claim?
In the ancient world, "kill em' all" was warfare rhetoric for "win a decisive victory," just as it is with our sports teams, for example.
- Egypt’s Tuthmosis III (later 15th c.) boasted that "the numerous army of Mitanni was overthrown within the hour, annihilated totally, like those (now) not existent." In fact, Mitanni’s forces lived on to fight in the 15th and 14th centuries BC. "Annihilated totally" was rhetoric.
- Hittite king Mursilli II (who ruled from 1322-1295 BC) recorded making "Mt. Asharpaya empty (of humanity)" and the "mountains of Tarikarimu empty (of humanity)." Not true; just rhetoric.
- The "Bulletin" of Ramses II tells of Egypt's less-than-spectacular victories in Syria (1274 BC). Nevertheless, he announces that he slew "the entire force" of the Hittites, indeed "all the chiefs of all the countries," disregarding the "millions of foreigners," which he considered "chaff."
- Moab's king Mesha (840/830 BC) bragged that the Northern Kingdom of "Israel has utterly perished for always," which was over a century premature. The Assyrians devastated Israel in 722 BC.
- The Assyrian ruler Sennacherib (701-681 BC) used similar hyperbole: "The soldiers of Hirimme, dangerous enemies, I cut down with the sword; and not one escaped."
Now, as far as Israel in specific, in the Merneptah Stele (ca. 1230 BC), Rameses II's son Merneptah announced, "Israel is wasted, his seed is not," (meaning the children were slaughtered)—another premature declaration. Not true, didn't happen, no genocide. Israel was just getting started.
When these ancient texts claim everyone was killed, it's rhetoric, not history, and they all knew it.
In this particular text, we have to realize that the Midianites were a large confederation of nomadic tribes. They roamed all through the areas of Sinai, the Negev, and the Transjordan. They were Bedouin by practice and culture, though there were some villages and a few walled cities that were populated by Midianites. The Israelites are not riding through the entire Middle East slaughtering innocents. Here (Numbers 31) it is those particular Midianites associated with Moab that are targeted. This particular collection of villages and been hostile to Israel, and they had been a moral detriment to the people. They had instigated hostility against them, and it was time for military action. The Israelites did execute the 5 kings of Midian (v. 8), but this is by no means a genocide. It's the government officials and soldiers that are being killed, not the women and children. By executing the five kings, they are seeking to destroy their sense of identity (what holds them together as a people group), so that they become powerless and leaderless. The Midianites show up later in the times of the Judges (Judges 6.1), to confirm for us that the ethnic group was not wiped from the face of the earth. Gideon defeated them in Judges 7, but they're still around as a people group. The prophet Habakkuk (Hab. 3.7) mentions them in about 600 BC, so they're still around then. The women and babies aren't being killed, and there is no genocide going on.
What it also helps you to recognize is that in those days the cities were fortresses surrounding governmental and cultic structures, not dwellings for the population. When commands were given to conquer cities, it was the rulers and soldiers the army was after, not the population. In the agrarian society of the Canaanite city-states, more than 90% of the people lived in the countryside as farmers, and less than 10% of the population lived in the cities. The cities were mostly fortresses and governmental centers. Almost exclusively, when a city was attacked, it was military action against military personnel and the rulers of the region, not against the general (and innocent) population. It was impossible, without nuclear weaponry, to wipe out all the citizenry. There was never an attempt to wipe them out. The women and children were not the targets; that was the rhetoric.
> In the conquest of Jericho, it seems very plain that literally everyone in the city (save Rahab) was put to death.
Jericho was a different situation than the Midianites. The city of Jericho was about 6-7 acres, sort of a small settlement in that era. It was a fortress, not a metropolis. The "king" of Jericho would have been a military commander. It was inhabited by the soldiers and the "king," along with whatever staff was there to support them (cooks, slaves, hookers, etc.). Obviously there were some women who lived there (like Rahab), but the presence of children would be minimal at best.
The Amarna letters give us some examples of the size of armies in Canaan in this era. The numbers are never higher than a few hundred and sometimes as low as 20 (this being the number requested by the kind of the important coastal city of Tyre [EA 151.14-16]). The evidence from the town closest to Jericho is that of the leader of Jerusalem, who requests 50 reinforcements (EA 289.42). Jericho was smaller than Jerusalem. Reasonably, it could have a hundred soldiers or less inside.
So you see that Joshua 6.21, mentioning men and women, young and old, cattle, sheep, and donkeys is rhetoric, not literal. Look at Joshua 10.40-42: "He totally destroyed all who breathed." Joshua 11.20: "Totally exterminating them without mercy." Nope. Warfare rhetoric, very common for the day. The text admits it: Judges 1.21, 27-28; 2.3. On the one hand Joshua says he "utterly destroyed" the Anakim (Josh. 11.21-22), but then he gives permission to Caleb to drive them out (Josh. 14.12-15).
Was Joshua a liar? No. He was speaking the language that everyone in his day would have understood, using common idioms to talk about his mighty victories. He says he "utterly destroyed" the Canaanites, and then very matter-of-factly assumes their continued existence that could pose a threat to Israel (Josh. 23.12-13).
So if Jericho were a fort, then "all" those killed inside were warriors along with political and religious leaders. Rahab and her family would have been among those conducting business for the soldiers and traders, serving their food and other needs.