The following excerpt was kindly provided by Ben Gadd, from his Handbook of the Canadian Rockies 2nd edition (Corax Press, 1995, page 55).
"Limestone is a very common rock type...but geologists didn't really know how it formed until the 1970s. The connection between limestone and life was well established - limestone is often richly fossiliferous - so it seemed likely that somehow sea life produced limestone by chemically removing dissolved lime (CaCO3, calcium carbonate to a chemist; calcite to a geologist) from the water and using it to form shells...
But the fossil content is a minor part of most limestone. Much of it is simply tiny crystalline bits of calcite. Where did the crystals come from? Not from land, for calcium enters the sea dissolved in water, seldom as particles. So limestone has to be made in place, in the sea.
As it turned out, the source was obvious but overlooked. In the 1950s, geologists began to look closely at spots where lime mud, the forerunner of limestone, was accumulating on the seabed...studies of lime deposition in the shallows of the Caribbean have shown that the vast proportion of lime mud begins as microscopically small, needle-like crystals of aragonite (a variety of calcite&) produced inside the tissues of floating and suspended cyanobacteria , which used to be called "bluegreen algae"...
The individual aragonite crystals produced inside cyanobacteria are so tiny that an electron microscope is needed to see them. When the cyanobacteria die and decompose, the aragonite needles drift to the bottom, building up deposits on the seabed.
Aragonite spontaneously recrystallizes to calcite...Most of the world's limestone is old enough for the aragonite to have converted itself to calcite; only rock formed relatively recently contains much aragonite.
It is reasonable to assume that the biochemical processes at work today off the Bahamas are much the same as those that produced the organic calcite of the Purcell Supergroup* 1.5 billion years ago. The same kinds of cyanobacteria existed then and now, and when allowance for ageing is made, the rock is chemically identical. So it seems plausible that cyanobacteria have been the prime producers of limestone for as long as there has been limestone; that is, for some 2.7 billion years.
Can limestone be produced inorganically? Yes. In warm, shallow tropical seas the water is saturated with dissolved calcium carbonate. Further warming of the water can cause a significant amount of calcite to precipitate (crystallize out). To a much lesser extent, evapouration of seawater can also produce carbonate rock."
*The predominant group of rock formations found in Waterton Lakes National Park.