Bacteria can exchange genetic material through several mechanisms, including transformation, transduction, and conjugation. Transformation involves the uptake of free DNA from the environment, transduction is the transfer of DNA by bacteriophages (viruses that infect bacteria), and conjugation is the direct transfer of DNA between bacterial cells through a structure called a pilus. These mechanisms contribute to genetic diversity and the spread of advantageous traits, such as antibiotic resistance.