It was a merciful warning to the rest of humanity
The lesson of the Flood had well-nigh faded from the memory of man; and, heedless of all restraint, the human family had made terrible advances in the course of open shameless vice -- so much so that there seemed an imminent danger of men repeating the abominable crimes that had opened the sluices of the Deluge. It was surely, therefore, wise and merciful to set up a warning, which told its own terrible story, and reminded transgressors that there were limits beyond which the Judge of all the earth would not permit them to go.
It is true that the visitation, if it temporarily alarmed the nations of the immediate neighborhood, did not prevent them from reaching a similar excess of immorality some centuries later, or from incurring at the edge of Joshua's sword the doom which heaven's fire had executed on their neighbors in the Jordan plain. Still, God's warnings have a merciful intention, even where they are unheeded; and this Sodom catastrophe has been well said to belong to that class of terrors in which a wise man will trace "the loving-kindness of the Lord."