It is narrated from Sayyiduna Muhajir bin Qunfudh (may Allah be pleased with him) that he greeted the Noble Prophet (peace and blessings be upon him). At that time, the Prophet (peace and blessings be upon him) was urinating, so he did not reply to his greeting. Then the Prophet (peace and blessings be upon him) performed ablution, and then replied to the greeting.
Brief Explanation
(Commentary on Hadith 2676)
From this hadith, it is understood that one should neither greet (give salam to) a person who is urinating, nor should such a person respond to the greeting in that state. However, it is not necessary to perform ablution (wudu) in order to reply to the greeting.
It is mentioned in Ibn Majah that the Prophet sallallahu alayhi wa sallam performed tayammum (dry ablution) and then replied, but that narration is very weak.
«كما مر آنفا».