Muslim (1). Thus, the man who prayed in an impure garment and did not become aware of the impurity until after he had finished is mistaken, not blameworthy. Had he known of the impurity, we would have said that he was blameworthy; but as matters stand, he made an unintentional mistake out of ignorance, so he is not required to repeat the prayer by virtue of this great verse, which is regarded as a foundational principle in the religion of Islam.
There is also evidence specific to this issue: when Gabriel informed the Messenger that there was something harmful or filthy on his sandals, he removed them (2) and continued his prayer. Had a garment whose impurity was unknown invalidated the prayer, he would have restarted it from the beginning.
As for forgetfulness—such as when one forgets that he has impurity on him, or forgets to wash it and then prays in the impure garment—the correct view is that he is not required to repeat the prayer.
The evidence is the saying of Allah, Most High:
“Our Lord, do not take us to task if we forget or make a mistake.” [al-Baqarah 2:286]
Another proof is what is authentically reported from Abu Hurayrah: the Prophet said, “Whoever forgets while fasting and eats or drinks should complete his fast.” (3) Eating and drinking while fasting are prohibited acts, and praying in an impure garment is likewise a prohibited act. Since its ruling is waived due to forgetfulness in the case of fasting, the same ruling concerning forgetfulness is extended by analogy to the case of prayer.