Ibn Hazm said:
Whoever is detained, whether he is traveling or not, in such a state that he cannot find dust or water, or he is being crucified, and the time for prayer comes, then he should pray as he is, and his prayer will be complete and does not have to be repeated, whether he finds water within the time of the prayer or after the time is over.
The proof of that is the aayahs (interpretation of the meaning):
keep your duty to Allaah and fear Him as much as you can”
“Allaah burdens not a person beyond his scope”[al-Baqarah 2:286]
And the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “If I command you to do a thing, then do as much of it as you can.”
And Allaah says (interpretation of the meaning):
“… while He has explained to you in detail what is forbidden to you, except under compulsion of necessity?”[al-An’aam 6:119]
From these texts we see that we are not obliged to do more than we are able to, and that if we are unable to do something, we are relieved of the obligation. We learn that Allaah has forbidden us to neglect wudoo’ or tayammum for prayer, unless we are forced “under compulsion of necessity”. The one who is deprived of water and dust is forced by necessity to do something which is forbidden, i.e., to forgo purifying himself with water or dust; so the prohibition does not apply in his case. But he is able to pray, fulfilling all the rulings on prayer and believing it to be obligatory, so it remains for him to do that which he is able to do. If he prays as we have mentioned, then he has prayed as Allaah has commanded him to do, and whoever prays as Allaah has commanded him to do is not to blame. And hastening to pray at the beginning of the time for prayer is preferable, because of what we have stated above.
Abu Haneefah, Sufyaan al-Thawri and al-Oozaa’i said, concerning one who is in this situation, that he should not pray until he finds water, when he finds it.