Calcite can be either dissolved by groundwater or precipitated by groundwater, depending on several factors including the water temperature, pH, and dissolved ion concentrations. Calcite exhibits an unusual characteristic called retrograde solubility in which it becomes less soluble in water as the temperature increases.
When conditions are right for precipitation, calcite forms mineral coatings that cement the existing rock grains together or it can fill fractures.
Karst topography and caves develop in carbonate rocks due to their solubility in dilute acidic groundwater. Cooling groundwater or mixing of different groundwaters will also create conditions suitable for cave formation.