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, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
We have previously explained in Fatwa 44692 that there are two types of urea; one is synthetic and it is pure and one is natural and it is impure. However, if the natural urea is treated by adding another pure substance to it so that the color, taste, and smell of the impurity no longer exist, then it is permissible to use it.
Therefore, it is permissible to use the contact lenses even if they were originally made from an impure substance if that substance was transformed during manufacturing into another substance. This is often the case with all the present-day industries since substances are mixed and are transformed into entirely different substances, which are different from their original nature.
If it was assumed that those contact lenses were made of the impure type of urea and it was not transformed and you could not find an alternative, then you would not be allowed to wear them because wearing impure objects without a legitimate necessity is prohibited. However, if you could not find any alternative enabling you to dispense with these contact lenses, then there is no harm in wearing them because seeking medical treatment by means of intrinsically impure substances – not to mention extrinsically impure substances – is permissible in case of a necessity as highlighted by jurists.
Al-‘Izz ibn ‘Abd As-Salaam said, “It is permissible to seek treatment by means of impurities if there are no pure alternatives available because the benefit of attaining medical treatment and preserving one's health outweighs that of avoiding impurities.”
An-Nawawi wrote, “It is permissible to seek treatment by means of impurities if there are no pure alternatives available to serve this purpose. If the pure alternative is available, it is prohibited to use the impurity in treatment and there is no difference of opinion among scholars about this.”
However, in this case (i.e. if the lenses are made of an impure substance), you are obliged to remove them during the prayer because one of the conditions for the validity of the prayer is the purity of both the body and clothing.
Allaah Knows best.