Using vaccines to boost immunity against disease is lawful, for it is a means of warding off something evil before it afflicts people. It is a duty of Muslims to do their best to ward off harm of all kinds, either before or after it comes. There is a juristic rule in this regard: Harm is to be warded off as much as possible.
In fact, scientists say that the polio vaccine contains neither harmful elements nor impure ones and that it does not cause infertility at all. This refutes the arguments of those who have claimed that the vaccine is harmful and thus unlawful.
Responding to the question, the eminent Muslim scholar Sheikh Yusuf Al-Qaradawi states the following:
In fact, I was completely astonished at knowing the attitude of our fellow scholars of Kano towards polio vaccine. I disapprove of their opinion, for the lawfulness of such vaccine in the point of view of Islam is as clear as sun light. I may understand their motives and good will behind this attitude, and I beseech Almighty Allah to reward them for their good will and to forgive them what they erred in that regard.
I, together with some trustworthy scholars in the Islamic Fiqh Council held in Muscat lately, have stated and asserted the importance of the following:
First, it is a duty upon every Muslim to ward off harm as much as he can. He must not do something that may cause him harm or lead to his death. One's self is a trust from Almighty Allah in one's hand, and thus it is not lawful for one to cause it harm.
Second, parents are responsible for providing their children as much as they can with all means of protection and immunity against harm and diseases in order to save them long-life suffering.
Third, people in authority in every country are to enact laws and take actions, by means of which the health of people in general, and children in particular, is to be protected against diseases.
Fourth, things are primarily in a state of purity.
Experts in the field in question, i.e., the polio vaccine, are the World Health Organization (WHO). We asked its branch in Egypt, whose staff is trustworthy and knowledgeable. They said that the polio vaccine is not harmful in any way, nor does it include impure elements or cause infertility. On the contrary, it is proved by experiment, thank Almighty Allah, to be highly effective in protecting against polio.
Fifth, polio vaccine has been used for a long time all over the world, including more than fifty Muslim countries, and has proved to be highly effective in eradicating the disease. No outstanding scholar, whether from Al-Azhar University, Al-Qarawyeen University, or in the Sacred Shrines, has been reported to have objected to the use of such vaccine.