It is narrated from Abu Qatadah (may Allah be pleased with him) that the Messenger of Allah ﷺ said:
إذا دخل أحدكم المسجد فلا يجلس حتى يصلي ركعتين
“When any of you enters the mosque, he should not sit until he has prayed two rak’ahs.”
Reference: (Sahih al-Bukhari: 444)