Identifying how past environmental conditions shaped the evolution of corals and their skeletal traits provides a framework for predicting their persistence and that of their non-calcifying relatives under impending global warming and ocean acidification. Here, we show that ocean geochemistry, particularly aragonite-calcite seas, drives patterns of morphological diversification in anthozoans (corals, sea anemones) by examining skeletal trait evolution in the context of a robust, time-calibrated phylogeny. The lability of skeletal composition among octocorals suggests a greater ability to adapt to changes in ocean chemistry compared to the homogeneity of the aragonitic skeleton of scleractinian corals. Pulses of diversification in anthozoans follow mass extinctions and reef crises, with sea anemones and proteinaceous corals filling empty niches as tropical reef-builders went extinct. Changing environmental conditions will likely diminish aragonitic reef-building scleractinians, but the evolutionary history of the Anthozoa suggests other groups will persist and diversify in their wake.