The most common explanation is that they served some religious purpose, but many archaeologists are very happy to label all kinds of things religious and ceremonial when they don't know what else to call it, so who knows? There have been very few artifacts found in them. We'll probably never find out.
("Ceremonial" is often archaeology speak for "we have no idea what the fuck this was for.")
My favorite thing is when archaeologists dig up female statues with big breasts and wide hips and call them evidence for a "cult of fertility". I guess that sounds more sciencey than "porn".
I actually heard a very interesting hypothesis about those statues, which I find compelling- pregnant women carved them as self-portraits, done by looking downward at their bodies, hence the odd proportions.
But sure, maybe porn. I can accept that too. We will probably never know.
The equivalent to this I know of are located outside of central europe, specifically Ireland. Located in and under church grounds and graveyards they were used to hide/store valuables during raids, if not the congregation in like the 6th century.
This was according to the local priest in deep rural donegal, mind you.