Although genome sequencing of microbial pathogens has shed light on the evolution of virulence, the drivers of the gain and loss of genes and of pathogenicity islands (gene clusters), which contribute to the emergence of new disease outbreaks, are unclear. Recent experiments with the bean pathogen Pseudomonas syringae pv. phaseolicola illustrate how exposure to resistance mechanisms acts as the driving force for genome reorganization. Here we argue that the antimicrobial conditions generated by host defences can accelerate the generation of genome rearrangements that provide selective advantages to the invading microbe. Similar exposure to environmental stress outside the host could also drive the horizontal gene transfer that has led to the evolution of pathogenicity towards both animals and plants.