Sexual reproduction likely evolved by LECA about 1.75 billion years ago. The presence of conserved meiotic genes across red algae, green plants, fungi, and animals suggests that LECA already possessed the machinery for recombination and DNA mixing.
Bacteria and viruses replicate, but they do not reproduce sexually. Sexual reproduction involving meiosis, recombination, and the fusion of genetic material, is a defining innovation of single-celled eukaryotic life. This evolutionary leap marks a major biological boundary: beyond simple copying, complex cells began reshuffling DNA, accelerating diversity and long-term adaptability.
Early sexual systems were often not male/female. Many unicellular eukaryotes have mating types, not sexes. Sometimes 2, sometimes 3, 4, or even dozens. In rare cases, thousands.
The ciliate Tetrahymena has 7 mating types. The fungus Schizophyllum can have thousands of compatible mating combinations due to multiple genetic loci. So sex does not require two categories. Two sexes (male/female) is a later stabilization that evolved in some lineages: especially animals and many plants. Early systems were about genetic compatibility, not gender.