Language:
كتاب العمل فى الصلاة
21  
Actions while Praying
(15)
Chapter: One should not return greetings during the Salat
(15)
باب لاَ يَرُدُّ السَّلاَمَ فِي الصَّلاَةِ
Sahih al-Bukhari 1217

Narrated Jabir bin `Abdullah:

Allah's Messenger (ﷺ) sent me for some job and when I had finished it I returned and came to the Prophet (ﷺ) and greeted him but he did not return my greeting. So I felt so sorry that only Allah knows it and I said to myself,, 'Perhaps Allah's Messenger (ﷺ) is angry because I did not come quickly, then again I greeted him but he did not reply. I felt even more sorry than I did the first time. Again I greeted him and he returned the greeting and said, "The thing which prevented me from returning the greeting was that I was praying." And at that time he was on his Rahila and his face was not towards the Qibla.

حَدَّثَنَا أَبُو مَعْمَرٍ، حَدَّثَنَا عَبْدُ الْوَارِثِ، حَدَّثَنَا كَثِيرُ بْنُ شِنْظِيرٍ، عَنْ عَطَاءِ بْنِ أَبِي رَبَاحٍ، عَنْ جَابِرِ بْنِ عَبْدِ اللَّهِ ـ رضى الله عنهما ـ قَالَ بَعَثَنِي رَسُولُ اللَّهِ صلى الله عليه وسلم فِي حَاجَةٍ لَهُ فَانْطَلَقْتُ، ثُمَّ رَجَعْتُ وَقَدْ قَضَيْتُهَا، فَأَتَيْتُ النَّبِيَّ صلى الله عليه وسلم فَسَلَّمْتُ عَلَيْهِ، فَلَمْ يَرُدَّ عَلَىَّ، فَوَقَعَ فِي قَلْبِي مَا اللَّهُ أَعْلَمُ بِهِ فَقُلْتُ فِي نَفْسِي لَعَلَّ رَسُولَ اللَّهِ صلى الله عليه وسلم وَجَدَ عَلَىَّ أَنِّي أَبْطَأْتُ عَلَيْهِ، ثُمَّ سَلَّمْتُ عَلَيْهِ فَلَمْ يَرُدَّ عَلَىَّ، فَوَقَعَ فِي قَلْبِي أَشَدُّ مِنَ الْمَرَّةِ الأُولَى، ثُمَّ سَلَّمْتُ عَلَيْهِ فَرَدَّ عَلَىَّ فَقَالَ ‏ "‏ إِنَّمَا مَنَعَنِي أَنْ أَرُدَّ عَلَيْكَ أَنِّي كُنْتُ أُصَلِّي ‏"‏‏.‏ وَكَانَ عَلَى رَاحِلَتِهِ مُتَوَجِّهًا إِلَى غَيْرِ الْقِبْلَةِ‏.‏
Reference : Sahih al-Bukhari 1217
In-book reference : Book 21, Hadith 21
USC-MSA web (English) reference : Vol. 2, Book 22, Hadith 308
  (deprecated numbering scheme)