Résumé: The most prominent pattern in global marine biogeography is the biodiversity peak in the Indo-Australian Archipelago. Yet the processes that underpin this pattern are still actively debated. By reconstructing global marine paleoenvironments over the past 3 million years on the basis of sediment cores, we assessed the extent to which Quaternary climate fluctuations can explain global variation in current reef fish richness. Comparing global historical coral reef habitat availability with the present-day distribution of 6316 reef fish species, we find that distance from stable coral reef habitats during historical periods of habitat loss explains 62% of the variation in fish richness, outweighing present-day environmental factors. Our results highlight the importance of habitat persistence during periods of climate change for preserving marine biodiversity.