The Hebrews of that time were obviously what anthropologists call a warrior culture. They have the same attitudes and morality of all the other warrior cultures I've studied, regardless of what God they worshipped, isnt that interesting?
The Native American tribes of the plains had the same values towards captive women and slaves, as did the Mongols, the feudal era Japanese, the early Germanic tribes like the Goths, the early Celts, the Aztecs, the Mayans...I could go on and on, and even up to recent times there were tribes in New Guinea who lived the lifestyle of a warrior culture. They had almost exactly the SAME attitude towards women captives as stated above in Numbers for the Hebrews. Raping female captives is always a feature of such cultures. It's a way of humiliating and assimilating the enemy at the same time.
The Human Genome project revealed that the maternal and paternal patterns of DNA are quite different for the human race. There's a distinct pattern of a few male DNA groups assimulating MANY maternal lines...in other words, you can tell the story of human conquest in earlier times by the pattern of conquering armies of men killing off rival males, and assimilating their females into their cultures. Best way EVER to get rid of an enemy in every way possible. Cut off the males passing on their DNA, and put your own into the enemy and they become part of your culture and lose their culture.
Male lions do the same thing when they take over a pride of females and their cubs. On some levels, humans are just pack predators...we've behaved very much like lions for a good part of our history.
Now, that tells me that this is just a feature of the rather barbaric (to our modern morality) of the warrior culture, a phase every human culture goes through at some point, and then MOVES ON, hopefully to something less barbaric.
The taking of body parts of the enemy as trophies (foreskins, in the case of the Hebrews..it's thought by many anthropologists that circumcision by certain Semitic tribes came about as not only an attempt to set themselves apart, but to deny their enemies a very important trophy which dishonored their God, Yahweh. Having the God demand it themselves as tribute is also nothing new...I could show you ritual sacrifice of certain "extraneous" body parts or blood, hair, something in every warrior culture.)
Warrior cultures make their gods or God into a conquering sky god too, inevitably. They associate him (and it's usually a masculine"father" deity) with the power of the Sun, thunder and lightening, and armies of minions to do their battles. Sound familiar?
I'm never surprised at the violence and allowance of things that seem horrible and barbaric among the early Hebrews in the Bible. It was typical of the times. I don't expect them to be any better than any other tribal culture of the time, and for their god to be any different in some ways than any others.
If you won, your God won, and if you lost, it was because God was mad at you, you'd been bad little warriors and hadn't made enough sacrifices or hadnt' obeyed your god.
As nasty as it all sounds to somewhat more civilized us, it's just one of those stages human cultures go through to get more civilized, we hope. Seems to work that way, anyway.
Religion is part of culture...it reflects the culture and occasionally even somewhat civilizes it but it's not going to make it jump past a usual stage of cultural evolution. That's not true of any religion, not even Christianity, one of the last of the biggies in religious cultural evolution.