At the end of פרשת בשלח, Hashem promises the Jewish people that if they observe the commandments, all of the sickness that they witnessed in Egypt, they will not see. Hashem reminds the nation, אני ה׳ רופאך, that I am the ultimate healer.

There was a time that עם ישראל was on such a high level that whenever they suffered any illness, they would go to the Prophet or חכם and ask what sin they committed that they need to do Teshuva. Once they repented, they were cured.

The Torah actually had to give permission to doctors to heal people.

This is in פרשת משפטים where two people get into a fist fight and one guy puts the other in the hospital. The Torah says he must pay the doctor bills of the one beat up. The Torah says, רק שבתו יתן ורפא ירפא, we only pay for disability and healing. The Gemara in בבא קמא says that this is the source for doctors to heal.

We must always remember that Hashem is the ultimate healer and must never assume any illness happens by chance. We should take the suffering as a vehicle to do Teshuva and come closer to Hashem.