He narrated that Sulayk came while the Messenger of Allah ﷺ was delivering the sermon, and he sat down. The Prophet ﷺ commanded him to pray two rakahs.Muhammad said in his version of the hadith, "Then he turned to the people and said, 'When one of you comes while the imam is delivering the sermon, let him pray two brief rakahs.'"
حدثنا محمد بن جعفر حدثنا سعيد وثنا روح وعبد الوهاب عن سعيد عن الوليد أبي بشر عن طلحة قال عبد الوهاب الإسكاف إنه سمع
يحدث أن سليكا جاء ورسول الله ﷺ يخطب فجلس فأمره النبي ﷺ أن يصلي ركعتين قال محمد في حديثه ثم أقبل على الناس فقال إذا جاء أحدكم والإمام يخطب فليصل ركعتين يتجوز فيهما
Its isnad is sahih. Saeed is Ibn Abu Aruba, and Abdul-Wahhab is Ibn Ata al-Khaffaf, whom Ahmad called al-Iskaf, both being his trades, and he is trustworthy and has a narration in Muslim. Walid Abu Bishr is Ibn Muslim al-Anbari, and he is trustworthy. Talha is Ibn Nafi. The hadith was narrated by Abu Dawud, 2/667, no. 1117, Hims edition, and Darimi, 1/438, no. 1503.