Abu Qatada (radi Allahu anhu) had gone to Masjid-e-Nabawi. When he saw the Messenger of Allah (sal Allahu alaihi wa sallam) sitting among his Companions, he went towards them and joined the group.
The Messenger of Allah (sal Allahu alaihi wa sallam) turned to Abu Qatada (radi Allahu anhu) and asked him, “What prevented you from offering two Rakaat of prayer?”
Abu Qatada (radi Allahu anhu) replied, “O Rasulullah, I saw that you and your Companions were sitting.”
Thereupon, the Messenger of Allah (sal Allahu alaihi wa sallam) said, “When anyone of you enters the Masjid, he should not sit before offering two Rakaat of prayer.” [Muslim, Musafireen]
Although the earth, everything on it – indeed everything in the universe and beyond – belongs to Allah (subhana wa ta’ala), yet Masjids have been designated as houses of Allah. It is not thinkable that I go to the house of someone very dear to me and not greet them on entering.
Therefore, when I enter a Masjid I should honour my being in Allah’s house and greet Him with two Rakaat of prayer.
This hadith has been sent to me by http://dailyhadith.adaptivesolutionsinc.com/