The term anchialine is Greek and means literally near the sea. Although this is the fact with such caves, the exact definition is slightly different. Anchialine caves are both inland and marine caves at the same time, they connect the land with the sea. And as a result they connect sweet water of the inland ground water body with salt water from the sea. This situation has both geologic and biologic consequences.
But first lets have a view on the morphology, the structure of such a cave. Most anchialine caves are karst caves, with a dry or river cave part far inland. The downward cave passage reaches the ground water at some point and becomes waterfilled, and finally it opens under water into the sea. There is an enormous number of such caves, which is a little astonishing at first. The most common anchialine caves are karst caves. But karst caves form by water draining the limestone, which means they follow a gradient which ends above sea level. Water will not flow uphill to reach the sea, so the ground water surface always starts at the coast at sea level and then goes up. Caves are formed along the karst water surface, so they may start at sea level, but then go upwards.
Other anchialine caves are lava tubes. Such caves are formed by a silent flow of lava downhill, which forms a solid crust and then the lava flows out when the eruption ends. But when the water reaches the sea, the hot lava boils away the sea water, and the lava is fast cooled down and becomes hard. The result is the formation of pillow lava. So lava tubes always end at the coast line.
Speleothems far below the ground water tell us, the cave was once dry, because speleothems do not form under water. And this is the key to the existence of anchialine caves. During the last 2 Million years Earth is in what is called an Ice Age. We are in the Ice Age now at the moment, but the Ice Age does not mean several kilometre thick glaciers all over the northern countries. In fact the continually grows and shrinks in its own rythm, and we are now at the warm end of the amplitude. During the cold periods much water was frozen in the enormous glaciers, and the sea level was 100 m lower than today. And in this time caves were formed draining to this much lower sea. When the cold period ended, the glaciers melted and the sea filled again, the caves were flooded by the rising sea.
Anchialine caves are very common in the tropics. Most of them are located on Yukatan peninsula, called cenotes, or in the Bahamas called blue holes. Obviously those names do not reflect the cave itself, as this cave was not visible to our anchestors. They only describe the almost circular holes, filled with blue water, which are collapses of the cave system below.
And now something strange happens. Sea water is much heavier than sweet water, because of the amount of dissolved salt. Sweet water and sea water does not easily mix, salt water tends to flow below sweet water and form a sort of lower level. As a result the water in the anchialine cave has a second surface, located several meters below the sweet water/air boundary lies the salt water/sweet water boundary or halocline. And it even looks like the water surface, it even reflects the light.