The Fiqh-based rule states that “preventing evil takes priority over bringing about benefit”, especially in the Hajj situation where the benefit goes to the individual while the harm will afflict a great number of people.
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states: As a Muslim that wants to go to Hajj, If you have a serious skin disease and it is not curable, and you are afraid of infecting others, you should not undertake Hajj. You are freed from the obligation to perform Hajj. However, if you wish, you can delegate someone to perform Hajj on your behalf.

By doing Hajj in this condition you may harm other people, while the principle of the jurisprudence states ‘let there be no harm or reciprocating harm.’ Remember, in Islam if we have been prevented from rendering an act of charity, we have other substitutes for what we have missed. So you don’t have to feel diminished or guilty.