If as-salaam (the greeting of Islam) was said to someone during his prayer, what should he do?
He should reply by signaling, as narrated by Sohaib (may Allah be please with him): "I passed by the Messenger of Allah (peace be upon him), while he was praying and I said salaam to him and he replied by signal." The description of the signal was narrated in many hadith, one of which is from Ibn Omar (may Allah be pleased with him), who said: The Messenger of Allah (peace be upon him) went to Qubaa’ (first Masjid in Medina) to pray. He said that the Ansaar (first Muslims of Medina) came to him and said salaam to him while he was praying. He said, "So, I said to Bilal, ‘How did you see the Messenger of Allah (peace be upon him) reply to them when they said salaam to him while he was praying?’" He said that he said, "Like this."and he flattened his hand. Jafar bin Awn (one of the narrators) flattened his hand and made the bottom of the hand facing down and the back of the hand facing up.1
From the book What Should You Do in the Following Situations... ?