The notion that diseases are contagious is a result of our worship of the means. No matter what present day research may say, the
research of the Sharī‛at is that the One who caused the first person to fall ill has caused the second one to fall ill as well. It is possible that others in the same house may also succumb to that illness. However, if our gaze is on the Absolute Power, then is it not better to attribute that illness to divine will than to the means? Is the will of Allāh ta‛ālā not even equal to the effect of means? We seek refuge in Allāh ta‛ālā.
The fact of the matter is that every person who is weak in his faith will rationalize his worship of the means by saying: “I do not deny the power of Allāh ta‛ālā but it is His norm that when a contagious disease enters a house, it is also passed on to others in that house.” The tauhīd of a Muslim demands that he attributes every single thing to the will of Allāh ta‛ālā. When this is realized, the means will become inconsequential in his sight. And if he has been blessed with full confidence in Allāh ta‛ālā, then the mysteries behind the effects of the means will be fully exposed to him.
Hadrat Maulānā Badr ‛Ālam rahimahullāh As quoted from Aqwāl-e-Salaf, vol. 9, pp. 605-606.