Corals form reefs by secreting calcium carbonate skeletons, which accumulate over time and create a solid structure.