Inspection of the genomes of bacterial pathogens indicates that their pathogenic potential relies, at least in part, on the activity of different elements that have been acquired by horizontal gene transfer from other (usually unknown) microorganisms. Similarly, in the case of resistance to antibiotics, besides mutation-driven resistance, the incorporation of novel resistance genes is a widespread evolutionary procedure for the acquisition of this phenotype. Current information in the field supports the idea that most (if not all) genes acquired by horizontal gene transfer by bacterial pathogens and contributing to their virulence potential or to antibiotic resistance originate in environmental, not human-pathogenic, microorganisms. Herein I discuss the potential functions that the genes that are dubbed virulence or antibiotic resistance genes may have in their original hosts in nonclinical, natural ecosystems. In addition, I discuss the potential bottlenecks modulating the transfer of virulence and antibiotic resistance determinants and the consequences in terms of speciation of acquiring one or another of both categories of genes. Finally, I propose that exaptation, a process by which a change of function is achieved by a change of habitat and not by changes in the element with the new functionality, is the basis of the evolution of virulence determinants and of antibiotic resistance genes.