وَلَقَدْ أَتَوْا عَلَى الْقَرْيَةِ الَّتِي أُمْطِرَتْ مَطَرَ السَّوْءِ
...
And indeed they have passed by the town on which was rained the evil rain.
refers to the town of the people of Lut, which was called Sodom, and the way in which Allah dealt with it, when He destroyed it by turning it upside down and by sending upon it the rain of stones of baked clay, as Allah says:
وَأَمْطَرْنَا عَلَيْهِم مَّطَراً فَسَأءَ مَطَرُ الْمُنذَرِينَ
And We rained on them a rain. And how evil was the rain of those who had been warned! (26:176)
وَإِنَّكُمْ لَّتَمُرُّونَ عَلَيْهِمْ مُّصْبِحِينَ
وَبِالَّيْلِ أَفَلَ تَعْقِلُونَ
Verily, you pass by them in the morning. And at night; will you not then reflect! (37:137-138)
وَإِنَّهَا لَبِسَبِيلٍ مُّقِيمٍ
And verily, they were right on the highroad. (15:76)
وَإِنَّهُمَا لَبِإِمَامٍ مُّبِينٍ
They are both on an open highway, plain to see. (15:79)
Allah says:
...
أَفَلَمْ يَكُونُوا يَرَوْنَهَا
...
Did they not then see it!
meaning, so that they might learn a lesson from what happened to its inhabitants of punishment for denying the Messenger and going against the commands of Allah.
...
بَلْ كَانُوا لاَ يَرْجُونَ نُشُورًا
Nay! But they used not to expect any resurrection.
means, the disbelievers who passed by it did not learn any lesson, because they did not expect any resurrection, i.e., on the Day of Judgement.