Specifically, why have it? Why not asexual reproduction? Well, there have been whole books written on the subject, but the upshot is that it seems to be a good long-term strategy to scramble your genome a bit and to allow individual animals to choose who their genes will be scrambled with.
Does that mean that sex is inevitable? Greg Egan postulates an alternative, in which individuals swap genetic information with their neighbors, which they then incorporate into their offspring.
Alternate quantum physics weirdness aside, this sort of horizontal gene transfer should be familiar to us from the way real-life bacteria exchange plasmids (and eukaryotes occasionally exchange exogenous retroviruses). Why not scale up this system to work for large animals?
Animals accept retroviruses from other animals and put them in a “library.” The next time they accept a retrovirus, they compare it to the ones they’ve already captured. Is the animal getting a lot of copies of the same gene from different donors? If so, perhaps that gene is useful and should be expressed.
That system is vulnerable to abuse, though. Retroviruses may code for nothing more than making other retroviruses. In other words, they are parasites, and waste the host’s resources. I can also imagine donors sending out trojan-horse retroviruses containing destructive code to kill off their competition. The solution would be for the host to watch its potential donors while they compete with each other and judge which donor seems healthiest and best suited for its environment. Then select the genes from that one…and I’ve re-invented sex.
Okay, what if, in order to swamp out the parasitic genes that might otherwise hijack the swap, organisms would copy and swap ALL of their genes? And to avoid disrupting organs already in operation, these new genes are sequestered and saved until they can make a contribution to the next generation…hell, I’ve re-invented sex again.
OKAY. Here’s yet another possibility, this one I know works because bdelloid rotifers have been doing it for millions of years. When a rotifer is stressed, it expels the water from its body and forms a cyst. The cyst sits there for however long it takes for conditions to improve, at which point it fills with water again and comes back to life. During its hibernation, its DNA was damaged (since the mechanisms that usually protect and repair it were dormant), so it takes DNA fragments from other rotifers that it sucked up along with the water and uses them to repair its own genome. This strategy has the added advantage of keeping the genome stable while times are good and everyone is reproducing parthenogenically, but introducing variation when times are bad and some new survival strategies might be in order.
Abuse of the system could be more viruses, and there may be something like sexual selection where rotifers huddle together with healthy individuals in order to make sure they get access to good gene-fragments. I can see how this system might evolve in time back into something like sex (it’s just such a good strategy) but bdelloid rotifers have been doing okay since the Jurassic, so maybe asexual reproduction works after all :). At least the system’s good enough for me to use for my Martians.