On the authority of Abu Sa’eed al-Khudri (radi Allaahu ‘anhu) that a man gave the salaam to the Messenger of Allaah (صلى الله عليه وسلم) while he was in prayer, so the Prophet (صلى الله عليه وسلم) replied by a gesture. And when the Prophet (صلى الله عليه وسلم) made the tasleem (and ended the prayer), he said to him: ‘Indeed we used to return the salaam (verbally) during our prayer, then we were prohibited from doing that.’”
Shaykh al-Albānī (rahimahullaah) comments:
“And in the hadeeth, there is clear evidence that the returning of the salaam verbally from the one who is praying used to be legislated at the beginning of Islaam in Makkah. Then, it was abrogated (and instead it was legislated) to return it by gesturing in Madinah. And if that is so, then there is (in this hadeeth) the recommendation of giving the salaam to the one who is praying, due to his (صلى الله عليه وسلم) iqraar (silent approval) of Ibn Mas’ood giving it, just as he silently approved of that from others who used to give him the salaam while he would be praying.
And there are many well-known narrations about that from different paths (of narration), and they are reported in more than one place. Thus, it is upon the followers of the sunnah to adhere to them, and to be gentle in conveying and applying them, for indeed the people are enemies toward what they are ignorant about, specially the people of desires and innovations among them.”