A major question in infectious disease research is how bacteria have evolved into highly niche-adapted pathogens with efficient host infection strategies. The plant pathogenic bacterium Xanthomonas campestris is subdivided into pathovars that occupy two distinct niches of the same plant leaf: the vasculature and the mesophyll tissue. Using a pangenome comparison of 94 X. campestris isolates, we discovered that the vasculature-infecting pathovar emerged in one monophyletic clade, has lost its CRISPR-Cas system, and showed an increase in both genomic plasticity and acquisition of virulence factors, such as type III effector proteins, compared with the ancestral pathovar. In addition, we show that the CRISPR spacers of isolates belonging to the ancestral pathovar map to plasmids that circulate in Xanthomonas populations and encode high numbers of transposons and virulence factors, suggesting that CRISPR-Cas restricts gene flow toward this pathovar. Indeed, we demonstrate experimentally reduced plasmid uptake in a CRISPR-Cas-encoding isolate. Based on our data, we propose that the loss of the CRISPR-Cas system was a pivotal step in X. campestris evolution by facilitating increased genome dynamics and the emergence of the vasculature-adapted X. campestris pathovar campestris, a major pathogen of Brassica crops.