CRISPR-Cas systems provide bacteria and archaea with an adaptive immune system that targets foreign DNA. However, the xenogenic nature of immunity provided by CRISPR-Cas raises the possibility that these systems may constrain horizontal gene transfer. Here we test this hypothesis in the opportunistic pathogen Pseudomonas aeruginosa, which has emerged as an important model system for understanding CRISPR-Cas function. Across the diversity of P. aeruginosa, active CRISPR-Cas systems are associated with smaller genomes and higher GC content, suggesting that CRISPR-Cas inhibits the acquisition of foreign DNA. Although phage is the major target of CRISPR-Cas spacers, more than 80% of isolates with an active CRISPR-Cas system have spacers that target integrative conjugative elements (ICE) or the conserved conjugative transfer machinery used by plasmids and ICE. Consistent with these results, genomes containing active CRISPR-Cas systems harbour a lower abundance of both prophage and ICE. Crucially, spacers in genomes with active CRISPR-Cas systems map to ICE and phage that are integrated into the chromosomes of closely related genomes lacking CRISPR-Cas immunity. We propose that CRISPR-Cas acts as an important constraint to horizontal gene transfer, and the evolutionary mechanisms that ensure its maintenance or drive its loss are key to the ability of this pathogen to adapt to new niches and stressors.