Jabir bin Abdullah reported,

We were with the Prophet ﷺ, and he sent me on an errand. When I returned, he was praying on his mount, facing a direction other than the qiblah. I greeted him with salam, but he did not respond.When he finished, he said, "Nothing kept me from returning your greeting except that I was praying."

Muslim 1207

Sahih

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

عن جابر قال

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

مسلم 1207صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Prohibition of speaking during prayer and abrogation of its previous permissibility
Numbering
Darussalam 1207
Muslim 1207