source: silsilat ul-ahaadeeth is-saheeha – the series of authentic narrations – hadeeth no. 2917
On the authority of Abu Sa’eed al-Khudri (radi Allaahu ‘anhu) that a man gave the salaam to the Messenger of Allaah (sallAllaahu ‘alayhi wa sallam) while he was in prayer, so the Prophet (sallAllaahu ‘alayh wa sallam) replied by a gesture. And when the Prophet (sallAllaahu ‘alayhi wa sallam) 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-Albaani (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 the recommendation of giving the salaam to the one who is praying, due to his (sallAllaahu ‘alayhi wa sallam) 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.”