"The first organisms to use DNA to replicate themselves were almost certainly small single-celled creatures, such as algae and bacteria. Fossil records suggest that they probably kept reproducing in this way for about two billion years.
At some point, however, the copying process changed. One theory is that ‘selfish’ DNA evolved the neat trick of directing the individual that contained it to fuse with another and then divide in half. Before long, this new DNA could have spread itself far and wide to ‘infect’ whole populations, a bit like a disease.
According to Professor Rick Michod, an American biologist who specialises in evolution at the University of Arizona, sex could have come about by accident as a result of eating of the dead.
Rick’s research team did experiments that showed that some bacteria consume the corpses of their neighbours, taking in DNA in the process. Bacteria that suffered most damage to their own DNA (for example, as a result of exposure to radiation from the Sun) were the greediest consumers of DNA from the dead. Rick believes those individuals may be using this borrowed DNA to repair their own. In the process, new genetic combinations could be made, and then copied when the cell divided, to create genetic variability among individuals."