The idea of resistance covers adaptations to a breadth of phenomena. Roughly, we can differentiate these factors into those that are chemical and organic, chemical and inorganic, physical, and biological. Biological factors include predators, herbivores, parasites, and other exploiter organisms as well as immune systems and other means by which potential victim organisms attempt to avoid being exploited other, exploiter organisms. Physical agents that can be harmful to microorganisms include desiccation and UV radiation as well as pH, osmolarity, and temperature extremes. Inorganic chemicals include especially heavy metals though also inorganic chemicals that can give rise to harmful physical changes in the environment such as pH and osmolarity extremes. Another class of inorganic chemicals are those that can chemically modify macromolecules such as hydrogen peroxide and other damaging agents including various inorganic mutagens and DNA damaging agents. Finally, there are organic chemicals that can be harmful to organisms. These agents typically are differentiated, by microbiologists, into disinfectants, antiseptics, antivirals, antifungals, antiparasitic drugs, bacteriocins, and antibiotics.
Antibiotics, in particular, consist of molecules that are of natural origin as well as, and less traditionally, those that are synthesized in the laboratory along with hybrid molecules that can be described as semi-synthetic. Here forward, unless I indicate otherwise, my use of the term 'antibiotic' will refer to organic chemicals of natural origin that display bactericidal or bacteriostatic effects on bacteria. Nonetheless, much of the consideration of bacterial resistance to these drugs can applied also to antibacterial drugs that are not of natural origin. The natural origin of antibiotics, however, introduces three important considerations. First, antibiotics play roles in microbial ecology that are independent of human impact on that ecology. Second, resistance to these compounds also is a natural phenomenon. And third, these compounds or at least the capacity of microorganisms to produce them has been evolving for presumably billions of years. As a result, a fairly large number of relatively broadly acting antibacterial chemicals exist that can be fairly easily isolated from a variety of microorganisms, though typically these have been organisms that are of soil origin.
Note that not all antibiotics are useful as drugs. In general an antibiotic has to display selective toxicity to be so useful, that is, being toxic to bacteria but not to ourselves. As the discussion in the previous paragraph should suggest, however, antibiotics in most cases have not evolved for the sake of not being toxic to ourselves so consequently not all antibiotics are useful for combating of infectious diseases affecting us. These latter issues are not our concern here, however. Instead we will focus on the issue of antibiotic toxicity to bacteria and, especially, how bacteria can respond to that toxicity over what for them are evolutionary time scales.
There are three basic ways that antibiotic resistance or any type of resistance can be acquired by a bacterium, or any adaptation by any organism. These are via mutation, recombination, and horizontal gene transfer. To a degree recombination and horizontal gene transfer can refer to similar phenomena, through for now by recombination I am referring to the generation of novel alleles by the intragenomic (within genomes) shuffling of sequences and by horizontal gene transfer I am referring to the intergenomic shuffling of different genes that come from different organisms (so too, recombination can result in mutations, so by mutation here I am implying changes in gene sequence that are other than or in addition to acquisition into specific locations within genomes of functional gene segments that have evolved elsewhere; mutations generate new information randomly while recombination that is not simply mutation represents a shuffling of "old" information). Different organisms can be closely related, as one sees with gene shuffling associated with meiosis, or they can be more distantly related, which is what is often being described when employing the term horizontal gene transfer. Leaving these details aside for now, antibiotic resistance typically is a result of either mutation so that target molecules are altered within bacteria or instead is a consequence of acquisition of genes that are new to an organism and which facilitate an antibiotic resistance. In either case, we can describe these phenomena as examples of acquired resistance. Furthermore, resistance that results from mutation often is described as chromosomal whereas that acquired from other organisms, typically plasmid encoded, is extrachromosomally associated.
Another way that one can consider resistance is in terms of the likelihood of its utility. An organism that lives exclusively in the presence of a specific antagonist such as high temperatures, high osmolarity, low pH, etc., will by necessity possess constitutive mechanisms of resistance, which is a description of how often the underlying genes are expressed (i.e., always). Note that this is not a description of whether the gene or genes are chromosomally versus extrachromosomally located. There is a tendency however for genes whose expression is consistently beneficial to become chromosomally located over the course of adaptive evolution since such a location can increase the evolutionary retention of these genes by the carriers of these genes (that is, fewer individuals are lost to inadvertent failure of, for example, plasmids to properly segregate between daughter bacteria).
Alternatively, genes that are less consistently beneficial to an organism can be extrachromosomally located, a strategy that can be viewed in terms of the genes themselves, or their extrachromosomal carrier, serving as the unit of selection for these genes rather than or in addition to the bacterium within which they reside. In addition, genes which are not always useful can have their expression controlled, that is, rather than being constitutively expressed, though timely control of gene expression in response to relevant sets of circumstances is not always easily accomplished.
In addition to considerations of gene utility, stability, and mobility, we can also speak of the impact of these genes on the carrying unit of selection. That impact, independent of whatever it is that a gene is encoding, typically can be detrimental. That is, there is a cost to having and expressing genes and that cost, to some extent, can be independent of the actual means by which a gene can be useful to an organism, e.g., such as in terms metabolic costs. This in fact is a utility associated with keeping gene expression under relatively strict control since unexpressed genes are less able to effect metabolic costs on their carriers.