Bacteria acquire resistance in a variety of ways. In some cases, enzymes native to the bacteria develop the ability to inactivate antibiotics before they have a chance to work. It is also common for the actual target molecule in the bacteria to be altered so the drug cannot bind to it, or that bacteria can find a means other than an affected metabolic pathway to obtain a necessary metabolite. Finally, resistance can occur if the bacteria find a way to prevent the drug from accumulating in the cell either by preventing it from getting in or increasing the rate that it is expelled.

Regardless of the mechanism of resistance, it is always genetically encoded. Some bacteria naturally have so-called resistance genes, in fact, bacteria found frozen in a glacier for 2,000 years were found to have some antibiotic resistance. Many bacteria and fungi produce antibiotic compounds to protect themselves from other microbes, and as a result, some of these microbes have evolved to be resistant to them. Resistance genes can also result from spontaneous mutations and can be passed on to other bacteria through normal genetic exchange processes. For example, bacterial cells can often transfer a circular strand of DNA outside of its own chromosome (called a plasmid) to another bacterium through a process called conjugation. Similarly, bacteria can acquire genes released from dead bacteria and incorporate them into their chromosome or plasmid through a process called transformation. Finally, in a process called transduction, a bacterial virus called a bacteriophage invades a cell and removes genetic material. When the bacteriophage infects another cell, that gene can be incorporated into its chromosome or plasmid.

Biology research labs have various standard procedures to induce bacteria to take up plasmids so they will express genes of interest. To test the success of the procedure, plasmids also contain a specific antibiotic resistance gene so that exposing the bacteria to the antibiotic will select for those expressing the genes on the plasmid. In addition, an article in a US newspaper described how to create resistant bacteria using culture medium plates, cotton swabs, and leftover antibiotic medicine.