Plant soil specialists contribute greatly to global diversity; however, the ecoevolutionary forces responsible for generating this diversity are poorly understood. We integrate molecular phylogenies with descriptive and experimental ecological data, creating a powerful framework with which to elucidate forces driving soil specialization. Hypotheses explaining edaphic specialization have historically focused on costs of adaptation to elements (e.g., nickel, calcium/magnesium) and accompanying tradeoffs in competitive ability in benign soils. We combine in situ microhabitat data for 37 streptanthoid species (Brassicaceae), soil analyses, and competition experiments with their phylogeny to reconstruct selective forces generating serpentine soil endemism, which has four to five independent origins in this group. Coupling ancestral state reconstruction with phylogenetic independent contrasts, we examine the magnitude and timing of changes in soil and habitat attributes relative to inferred shifts to serpentine. We find large changes in soil chemistry at nodes associated with soil shifts, suggesting that elemental changes occurred concomitantly with soil transitions. In contrast, the amount of bare ground surrounding plants in the field ("bareness"), which is greater in serpentine environments, is conserved across soil-type shifts. Thus, occupation of bare environments preceded shifts to serpentine, and may serve as an evolutionary precursor to harsh elemental soils and environments. In greenhouse experiments, taxa from barer environments are poorer competitors, a tradeoff that may contribute to soil endemism. The hypothesis of occupation of bare habitats as a precursor of soil specialization can be tested in other systems with a similar integrative ecophylogenetic approach, thereby providing deeper insights into this rich source of biodiversity.