I used to greet the Prophet (ﷺ) while he was in prayer and he would return my greeting, but when we returned (from Ethiopia) I greeted the Prophet (while he was praying) but he did not return the greeting, and (after finishing the prayer) he said, "In the prayer one is occupied (with a more serious matter)."
Reference: Sahih al-Bukhari 1216 In-book : Book 21, Hadith 20 USC-MSA web (English) : Vol. 2, Book 22, Hadith 307 (deprecated)
Help us gift a modern, ad-free Islamic application for the Muslim Ummah. Your donation will be recorded as Sadaqah Jariyah in your book of deeds, In Sha Allah.