EDIT WARNING: as soon as I posted I noticed someone deleted the parent comment... it commented something like some crimes (like murder, rape and "stealing my iPhone") always have no defense.
Some things, exist and are possible for good reasons...
People might condemn me and think I am some sort of crazy satanist for believing that even rape has its use...
For most part, rape is utterly evil and should be harshly punished, yet sometimes it was needed, and it might be needed again (I hope not, of course).
Also, how you get 100% effective in getting rid of murder, without also getting rid of soldiers, security guards, hunters or even construction workers? Well, then you need to separate intentional murder, from unintentional one (like a construction worker dropping a hammer from his toolbox into the head of a random person nearby the construction site), but even then, you end with issues like: if law was 100% effective, how you separate the preemptive killing of a armed rapist from murder?
Being a soldier and engaging a suspect enemy spy on your land is murder if he ends dead?
What if your iPhone has the only password needed to open a door to some secure building on fire, and you for whatever reason refuse to give it, it is wrong to steal your iPhone to save a life?
We cannot have 100% effective law enforcement, because there is no such thing of black and white issues on crime, several criminals do not believe themselves to be some sort of evil creature, yes, evil exists, but sometimes the actions of a criminal are just actions that you do not understand the motivation.
Obviously, to reproduce when there is no better alternative.
Thankfully, we are very, very, very long ways from that right now...
I doubt that rape was ever needed for the population to reproduce. Why do you think it was needed?
But nature developed that behavior for a reason...
Reason, yes, but not purpose. It may simply be a side-effect that didn't suffer enough evolutionary pressure to be extinguished. See male nipples, for example.
Pressure? What makes you think the pressure is against it?
Evolution operates on genes, not groups; not even individuals, really. Genes that somehow code for rape[1][2] will spread if and only if its carriers reproduce. The "use" of rape, then, should be fairly obvious: If successful, it lets its carrier reproduce.
Any such adaption is bound to be situational, as a healthy relationship is far more likely to produce surviving offspring, then and now. It'll be an "If you cannot get a girlfriend, then get urges towards rape" kind of thing, though typically enough there'll be a lot of variation in that.
There will not, however, be even the slightest degree of adaption in terms of what is best for the group. Group selection doesn't exist, outside of extreme laboratory conditions.
1: Or anything else.
2: Please don't read that as suggesting there might be a single "rape gene". Anything to do with the brain is really, really complex.
Remind me of Orson Scott Card's story (Ender in Exile), in which human crews building off-world colonies consisted of many more women than men (and temporarily allowed for polygamous relationships) to bootstrap the population faster.