R2R3-MYB transcription factors (TFs) participate in the modulation of plant development, secondary metabolism, and responses to environmental stresses. Ammopiptanthus nanus, a leguminous dryland shrub, tolerates a high degree of environmental stress, including drought and low-temperature stress. The systematic identification, structural analysis, evolutionary analysis, and gene profiling of R2R3-MYB TFs under cold and osmotic stress in A. nanus were performed. Up to 137 R2R3-MYB TFs were identified and clustered into nine clades, with most A. nanus R2R3-MYB members belonging to clade VIII. Tandem and segmental duplication events drove the expansion of the A. nanus R2R3-MYB family. Expression profiling revealed that multiple R2R3-MYB genes significantly changed under osmotic and cold stress conditions. MiR858 and miR159 targeted 88 R2R3-MYB genes. AnaMYB87, an miR858-targeted clade VIII R2R3-MYB TF, was up-regulated under both osmotic and cold stress. A transient expression assay in apples showed that the overexpression of AnaMYB87 promoted anthocyanin accumulation. A luciferase reporter assay in tobacco demonstrated that AnaMYB87 positively affected the transactivation of the dihydroflavonol reductase gene, indicating that the miR858-MYB87 module mediates anthocyanin accumulation under osmotic stress by regulating the dihydroflavonol reductase gene in A. nanus. This study provides new data to understand the roles of R2R3-MYB in plant stress responses.