Pleistocene climatic oscillations are known to influence the patterns of genetic diversity and the distribution of traits that are the target of selection. Here, we combine phylogeographical and ecological niche modelling (ENM) approaches to explore the influence of historical factors (Pleistocene climatic shifts) and natural selection on the evolution of distyly (two floral morphs) from tristyly (three floral morphs) of Oxalis alpina in the Sky Islands of the Sonoran Desert. Molecular data and ENM indicate that historical factors have had a strong influence on the genetic structure and the geographical distribution of reproductive systems of O. alpina. Moreover, genetic results suggest the possibility that distylous populations do not represent a monophyletic group. We propose that the combined effects of natural selection and genetic drift have influenced the tristyly–distyly transition.