It is narrated from Abdullah bin Umar (may Allah be pleased with them) who says: "The Messenger of Allah (ﷺ) came to the mosque of Banu Amr bin Awf. He (ﷺ) was praying when some people from the Ansar came and greeted him (with salam) while he (ﷺ) was in the state of prayer. Ibn Umar (may Allah be pleased with him) says: I asked Suhaib (may Allah be pleased with him), how did the Messenger of Allah (ﷺ) reply to them? He said: He (ﷺ) would gesture towards them."
Hadith Referenceمسند الإمام الشافعي / كتاب الصلاة / 189
Hadith Takhrijأخرجہ ابن ماجہ: الصلوۃ، باب المصلی یسلم علیہ کیف یرد: 1017 - والنسائی، السہو، باب رد السلام بالاشارۃ فی الصلاۃ: 1188 - وصححہ ابن خزیمہ: 888 - والحاکم: 12/3۔
It is narrated from Abdullah bin Mas'ud (may Allah be pleased with him) who says: "Before the migration to Abyssinia, we used to greet the Prophet ﷺ while he was in prayer, and he ﷺ would respond to us during the prayer. When we returned from Abyssinia, I came to the Prophet ﷺ to greet him. I found him ﷺ in prayer, so I greeted him, but he ﷺ did not respond to me. Various thoughts, both near and far, crossed my mind. I sat down until, when he ﷺ completed the prayer, I came to him ﷺ. He ﷺ said: Indeed, all praise is due to Allah, the Mighty and Majestic. He brings about new commands in His affairs as He wills, and what Allah has newly commanded is that you should not speak during the prayer."
Hadith Referenceمسند الإمام الشافعي / كتاب الصلاة / 190
Hadith Takhrijأخرجہ النسائی: السہو، باب الکلام فی الصلوۃ: 1222 - وابو داود، الصلاۃ، باب رد السلام فی الصلاۃ: 924 - وصححہ ابن حبان: 2243، 2244۔