Standing genetic variation represents a genetic load on population fitness but can also support a rapid response to short-term environmental change, and the greatest potential source of such standing genetic variation typically exists among locally adapted populations living along an environmental gradient. Here, we develop a spatially explicit simulation model to quantify the contribution of existing genetic variation arising from migration–mutation–selection–drift balance to time to extinction under environmental change. Simulations reveal that local adaptation across a species range associated with an underlying environmental gradient could extend time to extinction by nearly threefold irrespective of the rate of environmental change. The potential for preadapted alleles to increase the rate of adaptation changes the relative importance of established extinction risk factors; in particular, it reduced the importance of the breadth of environmental tolerance and it increased the relative importance of fecundity. Although migration of preadapted alleles generally increased persistence time, it decreased it at rates of environmental change close to the critical rate of change by creating a population bottleneck, which ultimately limited the rate at which de novo mutations could arise. An analysis of the extinction dynamics further revealed that one consequence of gene flow is the potential to maximize population growth rate in at least part of the species range, which is likely to have consequences for forecasting the consequences of ecological interactions. Our study shows that predictions of persistence time change fundamentally when existing local adaptations are explicitly taken into account, underscoring the need to preserve and manage genetic diversity.