In bacteria, recombination often occurs through mechanisms like conjugation, transformation, and transduction. In viruses, particularly RNA viruses like influenza and coronaviruses, recombination can happen during the replication process. This allows for the mixing of genetic material from different viral strains, leading to genetic diversity.