Bacterial speciation is somehow a mystery given that bacteria reproduce asexually, in other words, they don't have the benefit of genetic cross-overs to ensure enough genetic diversity in the new generations. So how do they achieve enough genetic diversification to ensure new speciation? Horizontal gene transfer is one way, and since it is not restricted to exchanges within species, it does achieve highly divergent traits.
Bacteria can exchange genes (often in the form of plasmids, circular bits of DNA), through bacterial conjugation, and this mechanism is thought to play a fundamental role in developing drug-resistant strains. Though gene-specific selective sweeps have been observed in bacterial populations (a gene allele that increases the fitness and hence prevails over the other alleles until it becomes the only allele in the population), this does not reconcile well with the current mathematical models of bacterial diversification, which seem to favor whole-genome sweeps rather than single-gene ones. A new Science study  shows that ecological differentiation between two recently diverged populations of bacteria is more similar to sexual differentiation than previously predicted by mathematical models. As Shapiro et al. conclude in their abstract:
"These findings reconcile previous, seemingly contradictory empirical observations of the genetic structure of bacterial populations and point to a more unified process of differentiation in bacteria and sexual eukaryotes than previously thought."Shapiro et al. sequenced whole genomes from two populations of ocean bacteria called Vibrio cyclitrophicus. They obtained 20 isolates, 13 from one lineage (called "L") and 7 from the second lineage (called "S"). The two lineages show evidence of recent ecological differentiation, but they also present over 99% average amino acid identity, making it an ideal framework for identifying recombination events.
"Our proposed evolutionary scenario is based on three lines of evidence: (i) Most of the genetic divergence between ecological populations is restricted to a few genomic loci with low diversity within one or both of the populations, suggesting recent sweeps of confined regions of the genome. (ii) We show that only one of the two chromosomes constituting the genome has swept through part of one population. (iii) The most recent recombination events tend to be population specific but older events are not, reinforcing the notion that these populations are on independent evolutionary trajectories, which may ultimately lead to the formation of genotypic clusters with different ecology."Based on the above observations, Shapiro et al. conclude that the two lineages under study came from a common and ecologically homogeneous population. They observed recently acquired, habitat-specific genes and a decrease in recombination events between populations, leading the two lineages to a recent divergence in protein-coding genes due to the different environments. By extrapolating this emerging trend, the researchers predict that the two lineages will eventually form genetically distinct clusters.
"Thus, a mechanism of gene-centered sweeps may eventually lead to a pattern characteristic of genomewide sweeps. In this way, our study of the very early stages of ecological specialization has provided a simple resolution to seemingly conflicting empirical observations."
 B. Jesse Shapiro, Jonathan Friedman, Otto X. Cordero, Sarah P. Preheim, Sonia C. Timberlake, Gitta Szabó, Martin F. Polz, & Eric J. Alm1 (2012). Population Genomics of Early Events in the Ecological Differentiation of Bacteria Science , 336 (6077) DOI: 10.1126/science.1218198