Specialization and concomitant tradeoffs are assumed to underlie the non-neutral coexistence of lineages. Tradeoffs across heterogeneous environments can promote diversity by preventing competitive exclusion. However, the importance of tradeoffs in maintaining diversity in natural microbial assemblages is unclear, as tradeoffs are frequently not detected in artificial evolution experiments. Stressful conditions associated with patches of heavy-metal enriched serpentine soils provide excellent opportunities for examining how heterogeneity may foster genetic diversity. Using a spatially-replicated design, we demonstrate that rhizobium bacteria symbiotic with legumes inhabiting contrasting serpentine and non-serpentine soils exhibit a tradeoff between a genotype's nickel tolerance and its ability to replicate rapidly. Furthermore, we detected adaptive divergence in rhizobial assemblages across soil type heterogeneity at multiple sites, suggesting that this tradeoff may promote the coexistence of phenotypically distinct bacterial lineages. Tradeoffs and adaptive divergence may be important factors maintaining the tremendous diversity within natural assemblages of bacteria.