The Messenger of Allah ﷺ saw a man standing apart who had not prayed with the congregation.He asked, "So-and-so, what kept you from praying with the people?"The man replied, "Messenger of Allah, I am in a state of major ritual impurity and there is no water."The Prophet ﷺ said, "Use clean earth, for that will suffice you."
أخبرنا سويد بن نصر قال حدثنا عبد الله عن عوف عن أبي رجاء
أن رسول الله ﷺ رأى رجلا معتزلا لم يصل مع القوم فقال يا فلان ما منعك أن تصلي مع القوم فقال يا رسول الله أصابتني جنابة ولا ماء قال عليك بالصعيد فإنه يكفيك
Bukhari narrated it in tayammum, chapter (9), hadith 348, from the hadith of Abdullah bin Mubarak, and Muslim narrated it in mosques, chapter on making up missed prayers and the recommendation of hastening to make them up, hadith 682, from the hadith of Raja Attaridi at length, and it is in Kubra, hadith 310.