In Numbers 31:1-18 God permits the Jews to keep all captive virgin girls for themselves during the war with Midian. Is this unjust?

The fact that the Bible strictly prohibits rape, fornication and adultery mitigates some of the concern over the treatment of these girls. Second, when a population is at war or when mortality is commonplace, it is necessary to rebuild the population as soon as possible so the age of consent decreases to females of reproductive age (i.e. early puberty). This is necessary for societal preservation in many cases.  Third, in warfare there are no prisons possible or feasible to accommodate all war captives. The fact that young girls were preserved is an act of mercy as the elderly and fighting-aged men would not be treated nearly as graciously with execution and slavery being the only two feasible options available to people at this time.

We live in a world of safety and cannot judge others in a different world by moral standards that were simply impossible at that time. I believe morals are a guide to conduct that would benefit the individual and/or produce an optimum-functioning society for that particular time and place.  Thus moral standards increase with prosperity and technology which allow one to do things that were impossible in previous generations due to poverty or the lack of ability or capability to do them. This is partially why Jesus said the Law of Moses was going to pass away and no one practices it today. Moral standards are proportionate to how advanced and prosperous a civilization is.  A primitive society cannot and does not have the ability to operate at our current level of morality. And we do not have the ability now to operate at an ideal level of morality now either:  For example, imagine a conductor driving a train. This conductor approaches a fork in the tract in which on one side are ten people tied to the track and on the other side is a child. The conductor is unable to stop the train in time and must run across one side of the tract.  Does either option seem perfectly moral?  Now imagine a train that can safely stop at a dime.  In this thought experiment we see that a society’s prosperity and sophistication allows it to improve its ability to be moral.  Modern societies are, therefore, not always justified in judging the actions of the past. Moral standards increase and improve as societies increase in prosperity and sophistication and are thus able to increase its standards of morality without causing societal collapse or other deleterious effects to society or individuals.