Altered environmental conditions due to anthropogenic climate change, such as rising temperatures, threaten biodiversity on Earth. In response, species may adapt evolutionarily to the novel environments and/or shift their ranges via dispersal to colonize suitable habitats. However, dispersal itself can evolve on ecological timescales, which could impact biodiversity maintenance under global change. Here, we explore theoretically how dispersal evolution modulates the response of metacommunities to climate change. We find that this response is heavily contingent on the environmental conditions experienced by the metacommunity prior to climate change. In particular, highly variable environments harbour dispersive but species-sparse communities. Species from such environments are more likely to survive climate change, as they can rapidly shift their ranges with their evolved dispersal abilities. In contrast, more stable environments lead to the evolution of less dispersive but more diverse metacommunities. Species' survival during climate change in such environments is less likely and depends on the evolvability of dispersal, as historically stable environments may lead to robust dispersal traits. We identify a limited set of scenarios in which contemporary dispersal evolution can rescue species from climate change. In doing so, we stress the importance of species' evolutionary histories and evolutionary rates, as determined by their genotype-phenotype maps, for their responses to rapid environmental change.