Concerning one who enters the mosque while the Imam is delivering the sermon
حَدَّثَنَا مُحَمَّدُ بْنُ الصَّبَّاحِ، أَنْبَأَنَا سُفْيَانُ بْنُ عُيَيْنَةَ، عَنِ ابْنِ عَجْلاَنَ، عَنْ عِيَاضِ بْنِ عَبْدِ اللَّهِ، عَنْ أَبِي سَعِيدٍ، قَالَ جَاءَ رَجُلٌ وَالنَّبِيُّ ـ صلى الله عليه وسلم ـ يَخْطُبُ فَقَالَ " أَصَلَّيْتَ؟" . قَالَ: لاَ . قَالَ: " فَصَلِّ رَكْعَتَيْنِ " .
It was narrated that Abu Sa’eed said: “A man entered the mosque when the Prophet (ﷺ) was delivering the sermon. He said: ‘Have you prayed?’ He said: ‘No.’ He said: ‘Then pray two Rak’ah.’”