´It was narrated that Jabir said:` “The Prophet (ﷺ) sent me on an errand, then I caught up with him while he was performing prayer, and I greeted him. He gestured to me, then when he finished, he called me and said: ‘You greeted me before, but I was performing prayer.’”
Hadith Referenceسنن ابن ماجه / كتاب إقامة الصلاة والسنة / 1018
Hadith Gradingالألبانی:صحيح | زبیر علی زئی:صحيح مسلم
1؎: The Prophet sallallahu alayhi wa sallam said this so that Jabir radi Allahu anhu would know the reason for not receiving a reply, and so that his heart would not be distressed. Subhan Allah, how much consideration the Prophet sallallahu alayhi wa sallam had for his companions radi Allahu anhum.
´It was narrated that Jabir said:` "The Messenger of Allah (ﷺ) sent me on an errand then I came back to him while he was praying. I greeted him with the salam and he gestured to me. When he finished he called me and said: 'You greeted me with Salam just now and I was praying.' And he was facing toward the east that day."
Hafiz Muhammad Ameen
1190. Commentary: "From the direction of the east" means that he was not facing the Ka'bah while performing the prayer, because in Madinah the qiblah is towards the south. However, during travel, it is not necessary to face the qiblah for voluntary (nafl) prayers. It is only required to face the qiblah at the beginning, and afterwards, regardless of which direction the mount turns, one should continue praying. From this, it is also established that it is permissible to greet someone who is praying, and for the one praying to respond with a gesture.
Source: Sunan Nasa'i: Translation and Benefits by Shaykh Hafiz Muhammad Amin Hafizullah, Page: 1190