A man became ritually impure and did not pray. He came to the Prophet ﷺ and told him about it. The Prophet ﷺ said, "You did the right thing."Another man became ritually impure, performed tayammum, and prayed. He came to the Prophet ﷺ, who said to him something similar to what he had said to the other, meaning, "You did the right thing."
أن رجلا أجنب فلم يصل، فأتى النبي ﷺ فذكر ذلك له فقال: أصبت. فأجنب رجل آخر فتيمم وصلى، فأتاه فقال نحو ما قال للآخر، يعني أصبت.
Narrated by Nasai (324), who said, Muhammad bin Abdul-Ala told us, he said, Khalid (bin Harith) told us, he said, Shubah informed us, that Mukharraq told them, from Tariq, and he related the hadith. Its chain of transmission is sahih, and Mukharraq is the son of Khalifah, one of the men [narrators] of Bukhari. Tariq bin Shihab is among the younger companions, he had only seen the Prophet ﷺ but did not hear from him, so his hadith is a mursal report from a companion, and mursal reports from companions are authoritative.In a version recorded by Ahmad (18832) through the route of Shubah, it states, "He did not fault either of them." His statement ﷺ to the two of them, "You have done well," is because each of them exercised his own judgment, and the Prophet affirmed the judgment of both and did not declare either of them mistaken. However, the one who prayed after performing tayammum was the more fitting choice. It is also possible to understand this account, concerning the man who did not pray, as having occurred before the verse on tayammum was revealed, and he simply could not find water. His statement, "he did not pray," means he did not pray within its designated time until he could perform ghusl and then pray it, even if that meant praying it as a makeup after the time had passed.