Many years ago I saw a documentary on PBS about a couple of archeologists who had spent some years tracking down the source of that story, as it was a common story in several religions with variants among different religious sects. And it took some time but they did eventually find the actual site, and they excavated it to try and gain some idea of what had actually happened there.
The ACTUAL history of the site was this: sometime around 2500 years ago some desert nomads traveling through the desert on a regular trading route found a new water hole that they hadn't known about, before, and it happened to be near the crossing of two well-treveled trading routs through the desert, and a significant distance from any other similar sites. So it quickly became a popular place for travelers and traders to stop as they crossed the desert. And as naturally happens under such circumstances, a "boom-town" soon sprung up, with all the usual lawless debauchery that come with them.
As with most boom-towns, the structures were hastily built out of whatever materials were at hand, and in this case those materials were a very porous, lightweight volcanic rock glued together with mortar of mostly sand, and water. They were not sturdy structures. Also, as the town sprung up and grew very quickly, it soon began to over-tax the water supply causing the people living there to keep digging deeper and deeper into the ground to get at the water they needed, and as they drained the aquifer they unknowingly created a big underground cavity that eventually collapsed into a giant sink-hole.
Most of the dwellings collapsed into the sink-hole, and the few that were left had fallen down or were soon abandoned as the water source was now gone. And with it, so was the reason for the town. And then time quickly reclaimed them, leaving an 'unnatural' depression in the Earth filled with and surrounded by a few broken bits of structure and an inordinate amount of that scorched, lightweight, volcanic rock (that humans had gathered to build with and then left there.
But the nomads continued to pass by the site on their trading routes, for centuries after, and they would tell each other and their children the stories of the wild boom-town that once existed, there, and how it had fallen victim to it's own boundless lusts. And as with all mythological stories the circumstances would change, some, with the telling and retelling of the story to better convey the significance and meaning that the story-tellers gleaned from the events. And those nomads traded among several different civilizations around the desert's edge, which is how similar versions of the story managed to find their way into so many different religious traditions.
All that being said, the mythical story remains. And we can ask ourselves why it has stuck in the minds of so many people for so long a time. What does it represent to them? And I think it represents a number of apparent truths. Mostly that mankind is punished by and through that with which it sins. With the adjunct question being why do the innocents so often get punished along with the guilty? THIS story says that they didn't. It says that everyone in that town was 'guilty'. But were they? We each have to decide for ourselves, I think. Because the question still stands even if not in this particular instance.