One of the worse stories found in the Bible is in Num. 31. Twelve thousand armed men, under Moses' leadership, attacked the Midianites. They killed all the males and burned all their dwellings. But they saved all the females alive, until Moses heard about it. Moses promptly commanded all the male children be killed, but all the females were spared who had not had intercourse.
"Now therefore kill every male among the little ones, and kill every woman that hath known man by lying with him. But all the female children, that have not known a man by lying with him, keep alive for yourselves." (Num. 31:17,18)
Now these females were not all children, for in verse 35, it gives the number of virgins.
"And thirty and two thousand persons in all, of WOMEN that had not known man by lying with him." (v. 35)
I think that this physical check would cause sexual arousal in most of the soldiers, however after several hundred checks it probably didn't.
What about the little girls, or big girls, who had fallen and ruptured their hymen? They were killed on the spot, because it looked like they had had intercourse.
There were regulations for prisoners in wartime also.
"And seest among the captives a beautiful woman, and hast a desire for her, that thou wouldest have her as thy wife, then thou shalt bring her home to thine house; ... and after that thou shalt go in unto her, and be her husband, and she shall be thy wife. And it shall be, if thou have no delight in her, then thou shalt let her go where she will. But thou shalt not sell her at all for money; thou shalt not make merchandise of her, because thou hast humbled her." (Deut. 21:11-14)