It is narrated from Sayyiduna Jabir (may Allah be pleased with him) that once the Prophet (peace and blessings be upon him) sent me for some task of his. I went, and when I returned after completing the task, I greeted the Prophet (peace and blessings be upon him) with salam, but he did not reply. When the Prophet (peace and blessings be upon him) finished the prayer, I said: O Messenger of Allah! I greeted you with salam, but you did not reply. The Prophet (peace and blessings be upon him) said: I was performing prayer at that time. At that time, the Prophet (peace and blessings be upon him) was on his mount and was not facing the qiblah.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 15166