Antibiotic-resistant bacteria are attributed to natural selection where exposure to antibiotics serves as an environmental selection pressure.
If antibiotic-resistant bacteria are present in the population, they will have a selective advantage, allowing them to continue living and replicating within their host and increasing the allele frequency for antibiotic resistance.
Conversely, bacteria that are susceptible to antibiotics will die.
Bacteria can exchange genetic material with each other through bacterial conjugations, spreading the alleles for antibiotic resistance.