Sayyiduna Abdullah bin al-Zubayr (may Allah be pleased with them both) narrated that the Messenger of Allah (peace and blessings be upon him) passed by some of his Companions when something had happened to them that made them laugh. He (peace and blessings be upon him) said: "Do you laugh while the mention of Paradise and Hell is before you?" Then this verse was revealed: "Inform My servants that I am the Forgiving, the Merciful, and that My punishment is the painful punishment."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13845