The underground of Denmark is the Danish Basin, a huge Mesozoic basin with continual downlift for several hundred million years. The basement of crystalline rock, the Precambrian Fennoscandian Shield, is covered by 12 km of Mesozoic sediments. Mostly marine sediments like limestone, marls, and sandstones, but also terrestrial sandstones and even evaporites like salt and gypsum at the bottom. The uppermost sedimentary rocks are chalk from the Cretaceous and Danian limestone, later the area was land and subject to erosion. In the center of the basins, the British Channel, German Baltic Sea coast, and northern Denmark, the white chalky limestone from the Cretaceous forms the spectacular white cliffs.
During the Cretaceous, about 70 million years ago, Denmark was covered by an oxygene rich, rather shallow sea, the home of fish, squid, mussels, snails, sea urchins and sponges. These organisms can be found today as fossils. Billions of microorganisms lived in the upper layers of the sea. The calcareous shells of these microorganisms form the chalk, if it is of particularly fine consistency it is called writing chalk. Black flint layers run through the chalk. They are the result of the quartz based shells of a part of the microorganisms, which was originally distributed finely through the chalk. The chemistry of the groundwater in the pores of the chalk was not homogenous, and so there were areas where the quartz was dissolved and others where it was redeposited. The result are those bands, which look like layers. The black color is mostly a result of the transparency, the light vanishes inside and is not reflected.
The salt layers deep below the ground created several halotectonic anomalies. A little simplified, the basement of crystalline rocks is covered by a thick layer of salt, which is covered by different sedimentary rocks. Salt is solid at the surface, but deep below other layers, under pressure, it is able to flow very slowly. And it is also a little lighter than the surrounding rocks, it has a lower specific weight than sedimentary rocks. So it starts to move upwards like gas bubbles in water, just a very slow, in geologic speed. It forms huge diapirs, mushroom like protrusions, and is able to lift the overlying rocks. As a result layers of limestone, which are normally deeper, below the ground moraine and other sedimentary rocks, are pressed to the surface by the salt. This applies to several places, and the three underground limestone quarries wie have listed are all located at such places.
During the Ice Age, the rocks were pressed downwards by the weight of mighty glaciers. Some parts were pulled along by the glaciers and relocated, others were massively eroded. The melting ice left huge blocks of crystalline rock originating from the Scandinavian craton. The northern part of Denmark was covered by up to 3 km of ice during the ice ages, the ice protruded during the coldest times to the Harz in Germany. But to the south it was thinner and thus less heavy. For about 12,000 years the ice is gone now, as a result this area is subject to a continual uplift caused by isostatic forces. The crust is freed from the load and, like a ship being emptied, it rises upwards. But geologic processes are slow, much slower than the melting, so it will take some more time until this neotectonic movement will come to an end. This process is called post-glacial rebound. The area has different rates of uplift, but 10 mm per year are quite common.
Denmark has almost no natural caves. The reason is very easy: the country is rather flat, not much elevation above sea level, and so there is no possibility for the formation of karst areas. The rocks are several Jurassic, Cretaceous, and Triassic sediments, among them limestone and chalk, which is normally a good thing. But karstification is hindered by long times of glaciation, and enormous deposits of ground moraine on top of the rocks. There are only a few karst feature, mostly in Nordjylland and on Sjælland, but no caves. And the moraine and sand beaches, and even the chalk cliffs are not suitable for sea caves. Nevertheless, Upper Cretaceous chalk and Danian limestone aquifers supply about a third of the drinking water for Denmark.