All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Whenever it is permissible for you to perform Tayammum instead of Ghusl from major impurity, then it is also permissible for you to perform the prayer in the mosque. This is the Fatwa issued in this regard by the Permanent Committee of Iftaa'.
The Permanent Committee was asked: “Is it permissible for a person in a state of major impurity who has a sound excuse for not using water for Ghusl (major ablution), like illness or injury, to attend the congregational prayer in the mosque?”
The Permanent Committee answered as follows:
“If there is a sound reason that prevents the use of water to purify oneself, either for Wudhoo' or for Ghusl, then one may perform Tayammum and pray in congregation in the mosque.”
The view of the majority of scholars is that the interval between the time of Tayammum for major impurity and the time of performing the prayer does not have legal consideration; the Fiqh Encyclopedia reads: “The majority of the jurists are of the view that a long interval between Tayammum and prayer does not invalidate Tayammum, and that it is not an obligation to perform prayer right after Tayammum, whereas the Maaliki School of jurisprudence is of the view that a long interval between Tayammum and prayer invalidates the Tayammum as they say that it is a condition that prayer be performed right after Tayammum.”
Allaah Knows best.