It is narrated from Jabir bin Abdullah (may Allah be pleased with him) who states that the Prophet (ﷺ) was delivering the sermon on Friday when a man entered the mosque. The Prophet (ﷺ) asked him: "Have you prayed?" He replied: "No." The Prophet (ﷺ) said: "Pray two rak‘ahs (Tahiyyat al-Masjid)."
Hadith Referenceمسند الإمام الشافعي / كتاب الجمعة / 431
Hadith Takhrijاخرجہ البخاری، الجمعۃ، باب من جاء والامام یخطب صلی رکعتین خفیفتین (931) ومسلم، الجمعۃ، باب التحیہ والإمام یخطب (875)۔