It is narrated from Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) that the Prophet (ﷺ) sent me on an errand. When I returned, he (ﷺ) was departing. I greeted him with salam, and he (ﷺ) gestured with his hand (as he was in prayer). When he (ﷺ) finished the prayer, he called me and said: "You just greeted (with salam) and I was in prayer." He (ﷺ) was heading towards the east.
Hadith Referenceالسنن المأثورة / باب ما جاء في صلاة الخوف / 62
Hadith Takhrijصحیح مسلم، المساجد ومواضع الصلاة باب تحریم الکلام فی الصلاة ونسخ ما کان من اباحة، رقم: 540۔