I entered the mosque, when the Messenger of Allah ﷺ had been sitting among people, and I also sat down among them. Upon this the Messenger of Allah ﷺ said: What prevented you from offering two rak'ahs (of Nafl prayer) before sitting down? I said: Messenger of Allah, I saw you sitting and people sitting (around you and I, therefore, sat in your company). He (the Holy Prophet) then said: When anyone among you enters the mosque, he should not sit till he has observed two rak'ahs. (Using translation from Muslim 714b)
عَنْ أَبِي قَتَادَةَ صَاحِبِ رَسُولِ اللهِ ﷺ قَالَ دَخَلْتُ الْمَسْجِدَ وَرَسُولُ اللهِ ﷺ جَالِسٌ بَيْنَ ظَهْرَانِي النَّاسِ قَالَ فَجَلَسْتُ فَقَالَ رَسُولُ اللهِ ﷺ مَا مَنَعَكَ أَنْ تَرْكَعَ رَكْعَتَيْنِ قَبْلَ أَنْ تَجْلِسَ؟ قَالَ فَقُلْتُ يَا رَسُولَ اللهِ رَأَيْتُكَ جَالِسًا وَالنَّاسُ جُلُوسٌ قَالَ إِذَا دَخَلَ أَحَدُكُمُ الْمَجْلِسَ فَلَا يَجْلِسْ حَتَّى يَرْكَعَ رَكْعَتَيْنِ