Interpreting the formation of genomic variation landscape, especially genomic regions with elevated differentiation (i.e. islands), is fundamental to a better understanding of the genomic consequences of adaptation and speciation. Edaphic islands provide excellent systems for understanding the interplay of gene flow and selection in driving population divergence and speciation. However, discerning the relative contribution of these factors that modify patterns of genomic variation remains difficult. We analysed 132 genomes from five recently divergent species in Primulina genus, with four species distributed in Karst limestone habitats and the fifth one growing in Danxia habitats. We demonstrated that both gene flow and linked selection have contributed to genome‐wide variation landscape, where genomic regions with elevated differentiation (i.e., islands) were largely derived by divergent sorting of ancient polymorphism. Specifically, we identified several lineage‐specific genomic islands that might have facilitated adaptation of P. suichuanensis to Danxia habitats. Our study is amongst the first cases disentangling evolutionary processes that shape genomic variation of plant specialists, and demonstrates the important role of ancient polymorphism in the formation of genomic islands that potentially mediate adaptation and speciation of endemic plants in special soil habitats.