Coral reefs are formed over long periods as coral polyps, tiny animals that secrete calcium carbonate, build upon each other's skeletons, gradually forming large structures when conditions like warm water, sunlight, and clear water are favorable.