Hazrat Abu Huraira R.A. reports that Rasulullah Sal’am said: ‘whenever anyone greets me at my grave, Allah returns my soul to my body so that I reply his greetings.’
In ‘Sharh-e-Manaasik’, Hazrat Ibn Hajar Rah writes that the meaning of the return of the soul is that Allah grants him the ability to speak. Hazrat Qazi Iyaaz Rah writes that the soul of the Nabi remains absorbed in the presence of Allah and on being greeted inclines towards the greeting. (Baz1) The majority of ulama are of the opinion (as Ibn Hajar, Allama Zurqani) that the meaning of the return of the soul is not that a body without a soul has now been given one. Being after the death of the Rasool Sal’am the soul had already returned once and for all. Hence what actually now happens is that the Nabi Sal’am returns the greetings.