But most caves form in karst, a type of landscape made of limestone, dolomite, and gypsum rocks that slowly dissolve in the presence of water with a slightly acidic tinge. Rain mixes with carbon dioxide in the atmosphere as it falls to the ground and then picks up more of the gas as it seeps into the soil. The combination is a weak acidic solution that dissolves calcite, the main mineral of karst rocks. The acidic water percolates down into the Earth through cracks and fractures and creates a network of passages like an underground plumbing system. The passages widen as more water seeps down, allowing even more water to flow through them. Eventually, some of the passages become large enough to earn the distinction of cave. Most of these solutional caves require more than 100,000 years to widen large enough to hold a human.
(Source: National Geographic/ Wikipedia)