Increasing evidence has emerged for non-random spatial distributions of microbes, but knowledge of the processes that cause variation in microbial assemblage among ecosystems is lacking. For instance, some studies showed that deterministic processes such as habitat specialization are important, while other studies hold that bacterial communities are assembled by stochastic forces. Here we examine the relative influence of deterministic and stochastic processes for bacterial communities from subsurface environments, stream biofilm, lake water, lake sediment and soil using pyrosequencing of the 16S ribosomal RNA gene. We show that there is a general pattern in phylogenetic signal in species ecological niches across recent evolutionary time for all studied habitats, enabling us to infer the influences of community assembly processes from patterns of phylogenetic turnover in community composition. The phylogenetic dissimilarities among-habitat types were significantly higher than within them, and the communities were clustered according to their original habitat types. For communities within-habitat types, the highest phylogenetic turnover rate through space was observed in subsurface environments, followed by stream biofilm on mountainsides, whereas the sediment assemblages across regional scales showed the lowest turnover rate. Quantifying phylogenetic turnover as the deviation from a null expectation suggested that measured environmental variables imposed strong selection on bacterial communities for nearly all sample groups. For three sample groups, spatial distance reflected unmeasured environmental variables that impose selection, as opposed to spatial isolation. Such characterization of spatial and environmental variables proved essential for proper interpretation of partial Mantel results based on observed beta diversity metrics. In summary, our results clearly indicate a dominant role of deterministic processes on bacterial assemblages and highlight that bacteria show strong habitat associations that have likely emerged through evolutionary adaptation.