Final answer:
Caves form when groundwater containing CO₂ dissolves limestone, creating cracks that enlarge over time. Stalactites and stalagmites form as calcium carbonate precipitates when water evaporates inside the cave.
Step-by-step explanation:
Caves form when groundwater containing atmospheric CO₂ finds its way into microscopic cracks in limestone deposits. Over time, the limestone dissolves, enlarging the cracks and eventually forming a cave. As groundwater seeps into the cave, water evaporates and causes the precipitation of calcium carbonate, resulting in stalactites and stalagmites.