During wound healing, stem cells provide functional mature cells to meet acute demands for tissue regeneration. Simultaneously, the tissue must maintain a pool of stem cells to sustain its future regeneration capability. However, how these requirements are balanced in response to injury is unknown. Here we demonstrate that after wounding or ultraviolet type B irradiation, melanocyte stem cells (McSCs) in the hair follicle exit the stem cell niche before their initial cell division, potentially depleting the pool of these cells. We also found that McSCs migrate to the epidermis in a melanocortin 1 receptor (Mc1r)-dependent manner and differentiate into functional epidermal melanocytes, providing a pigmented protective barrier against ultraviolet irradiation over the damaged skin. These findings provide an example in which stem cell differentiation due to injury takes precedence over stem cell maintenance and show the potential for developing therapies for skin pigmentation disorders by manipulating McSCs.