It all began gazillions of years ago (to use the proper geological measure), when the earth was young and suffering motivational problems. It took all the calcium-carbonate-bearing rocks it had and dissolved them, in a sustained fit of malicious mischief. Calcium carbonate, to its great regret, is somewhat water-soluble; it is even more at the mercy of carbonic acid — a solution of carbon dioxide in water. Well, wouldn’t you know it: the primeval seas were one big vat of seething soda pop, dissolving lime and precipitating it into a limy ooze all over the ocean floor. (Parents of small children and veterans of communal living will appreciate the unsavoriness of this situation.)
Somewhere along the line, life began and, in precedent-setting fashion, made a worse mess of things. Primitive plants, grunting and gesticulating obscenely, made off with nubile carbon-dioxide molecules, thereby decreasing calcium carbonate solubility and causing more of the stuff to be deposited. Later on, shellfish, who incorporated dissolved lime into their skeletons, lived and died and sank into the ooze because there were as yet no humans to pretend that they like eating them.
Time and pressure worked their inimitable magic, squooshing the ooze, compacting it and forcing the water out, and presto — quicker than you can read Bleak House — limestone! Every third eon or so, a minor alteration of geological conditions, such as evaporation of an ocean, caused an interruption of calcium depositing, and the interpolation of some other less soluble substance – shale or mica, for example. It is a small thing to us, but it was no doubt viewed with consternation at the time. The ultimate result was a series of marginally separated overlying beds of limestone, more than a thousand feet thick in the aggregate.
Then the earth hiccupped — the carbonic acid, you know — and the ocean floor became dry land. Further gastric distress on the part of the earth caused older underlying rock, e.g., granite, to thrust up through the limestone to form mountains. The accompanying upheaval wrought severe stress upon the limestone. Pressure, interruptions, upheaval, stress — the old familiar story, with a familiar result. The limestone cracked. Now, in addition to the interstices which ran along the bedding planes — the boundaries between beds — vertical cracks at right angles to those planes roamed hither and yon through the limestone mass. Some extended to the surface and the whole depraved cycle began again.
Surface water, acquiring carbon dioxide from decaying matter in the soil, seeped into microscopic cracks in the limestone and commenced to re-dissolve the long-suffering mineral. The more limestone was eaten away, the more water gained access, dissolving still more limestone, and the process accelerated. After eons in number too tedious to recount, ground water collected from all over the area overlying the limestone and became concentrated into one or more streams gushing through newly carved passages. Swift-moving water, with its capacity to abrade rock, encouraged the excavation process. In its initial forays, water sought out the interstices in bedding planes and fissures, and these structures (or lack of them) determined the courses of future underground passages.