A) Divine Condensension: Jesus points to this idea in Deuteronomy when he talks about how Moses allowed divorce in Israel “out of the hardness of their hearts”. Basically, the laws were incomplete in some way, either making compromises with a stubborn people or having to involve means more familiar to the ancient Israelites to make a point. Also, just about each of the troubling commands come from Deuteronomy, meaning “second law”. What was the first law? The ten commandments and a few other ritual regulations in Exodus, but the Israelites failed big time with the golden calf, and then by messing with the midianite women at Peor. Deuteronomic law modifies a lot of the stuff in Exodus (as well as ritual law in Leviticus), normally towards more laxity and to commands more difficult to swallow. But we should never see these as what God originally had in mind. And neither do the scriptures themselves. God later says to Ezekiel with reference to Deuteronomy “I gave them laws that were not good” (btw, this is basically an argument that Scott Hahn makes in one of his more academic papers… I suggest you look it up).
C) Restraint: However, in order for Divine condensension to be condensension, the behavior allowed can’t be more “immoral” than typical cultural expectations. In the case of Harem warfare, what Israel was allowed to do was far more constrained than what other nation states did. The could only go Harem on a small list of nations who were historically hostile to Israel but related to it and aware of its “inheritance”, whose practices would have certainly corrupted Israel, and they could not do so unless provoked, and prior warnings were given to those involved. Furthermore, looking closely at the language, what you do find is that “wiping out” a nation was more about destroying the actual “structure” of the nation, to the point that the people are dispersed and can’t recollect themselves, in many cases, even nations that were “wiped out” still had inhabitants chilling around long after the nation itself was gone. Harem warfare was far more destructive when used by other nations, however.
B) Collective cultures: I’m not appealing to moral relativism here, but we should consider to what extent our moral sensibilities are influenced by Enlightenment style individualism. Israel saw itself as God’s firstborn son, God’s servant, God’s bride, etc. But this is true of other nations. They are seen, also, like single entities. Hence, you might have innocent people killed in some mass plague or disaster, but the punishment is on the nation as a whole. Jesus points to something like this when he comments on the meaning of a collapsing tower that killed a bunch of people. He warned the Jews that those who died weren’t any more wicked than those who live now, but the nation as a whole is being warned for its corruption. We will not be condemned to hell for the actions of another, and in that way God judges each of us individually, but we can suffer consequences en masse when moral rot is widely spread.
These three, combined, with God as the author of life, make sense to me of the difficult passages in question.