Jabir bin Abdullah reported,

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

Azami 2595

Sahih

عن جابر بن عبد الله قال

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

الأعظمي 2595صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
What is prohibited and disliked in prayer
Section
Prohibition of returning the greeting during prayer
Numbering
Jami al-Kamil 2595 (2nd edition)
Azami 2595