Let's set aside the fact that your question, regarding how we can trust boys in the military to keep us safe, if we can't trust them not rape, mixes two unrelated logical categories, rape and military effectiveness: You're right, people have a basic human right not to be raped (or murdered, or beaten, or robbed, . . .). This applies not just in the military, but in civilian life as well. Yet my wife and daughters won't go into certain neighborhoods or areas unescorted, or put themselves in certain situations, in spite of their basic human right to do so without incurring harm. That is called prudence.
But really, apart from women's inefficacy as combat troops, the biggest problem posed by the mixing of the sexes in combat units is not that the former might rape the latter, but as Dr. Sowell pointed out, that the two sexes distract each other in ways that are deleterious to unit cohesion and morale. I would add that, in this context, the protective instinct of _decent_ men towards their women is the biggest problem, in a real combat situation.