Jabir bin Abdullah reported,

The Messenger of Allah ﷺ sent me on an errand, so I set out, completed it, and returned. I came to the Prophet ﷺ and greeted him with salaam, but he did not return my greeting. Something fell into my heart that only Allah knows, and I said to myself, "Perhaps the Messenger of Allah ﷺ is displeased with me for being slow."Then I greeted him again, and he still did not return my greeting. What fell into my heart this time was even worse than the first.Then I greeted him a third time, and this time he returned my greeting. He said, "What kept me from returning your greeting was that I was praying."He was on his mount, facing a direction other than the qiblah.

Bukhari 1217

Sahih

حدثنا أبو معمر حدثنا عبد الوارث حدثنا كثير بن شنظير عن عطاء بن أبي رباح

عن جابر بن عبد الله رضي الله عنهما قال

بعثني رسول الله ﷺ في حاجة له فانطلقت ثم رجعت وقد قضيتها فأتيت النبي ﷺ فسلمت عليه فلم يرد علي فوقع في قلبي ما الله أعلم به فقلت في نفسي لعل رسول الله ﷺ وجد علي أني أبطأت عليه ثم سلمت عليه فلم يرد علي فوقع في قلبي أشد من المرة الأولى ثم سلمت عليه فرد علي فقال إنما منعني أن أرد عليك أني كنت أصلي وكان على راحلته متوجها إلى غير القبلة

البخاري 1217صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Work during prayer
Chapter
Not returning the greeting during prayer
Numbering
Darussalam 1217
Bukhari 1217