It's not a story I read too often. I was thinking that "Moses never entered the Promised land" so I stand corrected for this must have happened prior to the crossing of the Jordan.Wires crossed on your hotline with God?
Numbers 31:7-18
They fought against Midian, as the LORD commanded Moses, and killed every man. Among their victims were Evi, Rekem, Zur, Hur and Reba - the five kings of Midian. They also killed Balaam son of Beor with the sword. The Israelites captured the Midianite women and children and took all the Midianite herds, flocks and goods as plunder. They burned all the towns where the Midianites had settled, as well as all their camps. They took all the plunder and spoils, including the people and animals, and brought the captives, spoils and plunder to Moses and Eleazar the priest and the Israelite assembly at their camp on the plains of Moab, by the Jordan across from Jericho.
Moses, Eleazar the priest and all the leaders of the community went to meet them outside the camp. Moses was angry with the officers of the army - the commanders of thousands and commanders of hundreds - who returned from the battle.
"Have you allowed all the women to live?" he asked them. "They were the ones who followed Balaam's advice and were the means of turning the Israelites away from the LORD in what happened at Peor, so that a plague struck the LORD's people. Now kill all the boys. And kill every woman who has slept with a man, but save for yourselves every girl who has never slept with a man."
So, in other words, kill them all but save the virgins for yourself. That makes Moses a rapist too.
They didn't have the Geneva Conventions in those days.