Wa`alaykum as-salam wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear questioner, we'd like to thank you for the confidence you place in us. May Allah help us satisfactorily fulfill our duties for His sake. Amen.
Scholars maintained that one of the main objectives of Shari`ah is protecting people's life and maintaining their health. Human life is so highly appreciated in Islam that the matters relating to health take precedence over acts of worship.
The Prophet Muhammad (peace and blessings be upon him) said, "There should be neither harm nor reciprocation of harm." (Ibn Majah) This hadith illustrates that a Muslim should not be a source of harm for others in any way.
Answering your question, sheikh `Atiyyah Saqr, former head of Al-Azhar Fatwa Committee, stated,
If the disease is verified and the infection is likely to occur, then the infection or disease suggests cancellation or delay of the obligation of Hajj for the infected people until they recover. A fiqhi (juristic) rule states that averting (the causes of) harm has precedence over bringing about benefits. The benefits of performing Hajj go to the one who performs this obligation while harm is the share of others, in case of those with infectious diseases.
Thus, I believe that if such people take the risk of going to Hajj while their Hajj can be cancelled because of the infection, then this act is forbidden, either by way of karahah (religious reprehension) or tahrim (prohibition), depending on the degree of infection.
There are many hadiths that warn against exposing oneself to infection or causing it. Imam Muslim reported that there was a leper among the delegation of Thaqif, who came to pledge allegiance to the Prophet (peace and blessings be upon him). Upon knowing that, Allah's Prophet sent him the following message: "We have accepted your allegiance, so you may go." Also, Imam Al-Bukhari reported that the Prophet said, "Run away from the leper as you run away from a lion."
Based on this rule (i.e., the prohibition of inflicting or reciprocating harm), Islam forbids the carrier of the disease from mixing with healthy people because that can transmit the infection to them, either directly or indirectly. Islam also forbids spitting in the streets and other public places. It forbids urinating and defecating in water sources and any places frequented by people. It orders Muslims to kill the insects, vermin, and other creatures that can harm people, even during ihram (state of ritual consecration
Imam Malik reported that `Umar ibn Al-Khattab (may Allah be pleased with him) saw a leprous woman performing Tawaf (circumambulation of the Ka`bah) among people. He said to her, "O maidservant of Allah! Do not harm others. Why do you not stay home?" The woman obeyed him and stayed home. When `Umar died, a man visited her and said, "The one who forbade you from making Tawaf has passed away. You may now go and perform Tawaf." She replied, "Having obeyed him in his life, I shall not and disobey him after his death."
May Allah guide all of us to what pleases Him!