I'm pretty sure the women children in Numbers 31:18 where just thrilled to suddenly be married off to the very men who had just slaughtered their families. Everyone yelled "mazel tov!" and they happily skipped off to the marriage tent. No rape there. Nope, none at all.
And yes, that is a command from their deity as to how to treat the residents of the place they were attacking.
Numbers 31:18 But all the women children, that have not known a man by lying with him, keep alive for yourselves.
Such things were common for the time around the world. What made the early Israelites very different from my own ancestors was they killed male children rather than take them back as farm hands/helpers and later giving them rights of inheritance. I suppose they were attacking "foreigners" though and in the case of my ancestors, we usually only attacked our neighbors. Well, until forced christianization, then we started leaving in droves and slaughtering everything in sight. (We still kept the women and children though) I believe you call this the beginning of the "Viking age".
Another huge difference - Heathens admit our ancestors did such things and in our case, this is usually - almost always - our direct ancestors. I have no idea why so many christians have a problem with such verses, especially considering those are almost never, ever their actual ancestors, only their spiritual ancestors. If they were actual ancestors they'd be Jewish, not christian.