“And Hashem said; If you will heed the voice of Hashem your God and you will do what is proper in His eyes and you will listen to his mitzvos and be careful to keep all of His ordinances, all the ailments that I put in Mitzrayim I will not put on you, because I am Hashem your healer.”
Zera Shimshon asks; this possuk seems to be inconsistent. In the first part of the possuk, Hashem tells Bnei Yisroel that if they keep Hashem's mitzvos, Hashem will protect them from all types of ailments. This means that they will not get sick. In the second part of the possuk it is written that the reason for this is because Hashem is a healer. If Bnei Yisroel won't get sick why do they need a doctor?
Zera Shimshon answers in light of a Halacha (Choshen Mishpat 420/21) if Reuvain injures Shimshon and Reuvain tells Shimshon that he shouldn't go to a doctor but that he himself will heal him, Shimshon can demand that Reuvain will pay for a different doctor to heal him. The Gemara explains the reason for this is that the one who is injured can argue that he considers the assailant to be a "ferocious lion". The Ro'sh explains the reasoning for this is that for a doctor to successfully treat a patient, the patient has to have trust in a doctor. Since in the eyes of the one who was injured the one who injured him is a "ferocious lion" he has no trust in him and Shimon will not be healed and therefore Shimon can demand money to hire a doctor in whom he trusts.
Hashem is the ultimate healer and because of this, if He would make a member of Bnei Yisroel sick, Hashem would not be able to heal them because there would be no trust in Him. According to this, the last part of the possuk is explaining the first half; since, "I am Hashem your healer" therefore, "All the ailments that I put in Mitzrayim I will not put on you" because if I will give you an ailment I will not be able to heal you.
According to this we can understand another Medrash that Hashem creates the cure for an illness that He inflicts on Jewish people before the illness. What do we gain from this?
We can explain in light of the above. If Hashem would create the cure after the illness then the unhealthy person would view the medicine as something that Hashem prepared specifically for them and it is as if "the ferocious lion" that made him sick in the beginning is trying to heal him. He would have no trust in the cure and would not easily be cured. However, since the cure was created before the sickness, the sick person doesn't attribute the cure to the One who made him sick so there is more chance that the person will be healed.
Zera Shimshon proposes that this is not always the case. If a person truly believes that even though Hashem brought on him his illness, Hashem had his best interest in mind and therefore he trusts that Hashem will heal him, he will be healed by Hashem. Zera Shimshon brings a proof to this. We say in Shmoneh Esrey; Refa’ainu Hashem v'nairofey hoshee’ainu Hashem v'neevahshayah ki seh'heelosainu ahtah which is usually translated as; Heal us Hashem and we will be healed. Save us Hashem and we will be saved because You are our glory. However, the source of this phrase is the possuk (Yirmiyahu 17/14) רְ פָאֵנִי יְדוד וְאֵרָפֵא הוֹשִיעֵנִי וְאִוָשֵעָה כִי תְהִלָתִי אָתָה׃ and Rashi there translates the last phrase differently; Hashem heal me and I will be healed, save me and I will be saved for I praise myself and boast with You that you are my savior. What does it mean that Hashem heals and saves us because we praise ourselves that Hashem is our savior?
According to the above it is very understandable; Even though Hashem is also the One that made us sick, since we praise and boast that Hashem is our savior, which basically means we trust Him. Therefore Hashem can and will save us. However if we don't really feel that Hashem is our savior then Hashem will not cure us since we regard Him as a "ferocious lion"!