Accepting the will of the Almighty when one is ill has curative powers.
Rabbi Simcha Zissel of Kelm wrote to an ill person that all doctors advise their patients to have a calm attitude. The question is how a patient can master this attitude. The Sages have shown us the way -- to accept our suffering with joy.
The benefits gained from awareness of the Almighty are exactly what we need for our physical well being. This is what the verse (Chabakuk 2:4) teaches: "The righteous person will live with his belief." Their belief will cause them to live. It will strengthen them and bring them joy. As it says: "The person with a good heart has a continual feast" (Proverbs 15:15).
The Vilna Gaon comments that when a person goes to a party, he might feel happy, but as soon as the party is over the happiness is gone. But a person with a good heart, that is, the right attitudes, is always happy. Awareness of the Almighty gives a person a good heart to understand that whatever happens is God's will. Suffering is meant to be merciful to a person, to arouse him to mend his ways in order that he find eternal pleasure.
(Chochmah U'mussar, vol.2, p. 291; Rabbi Pliskin's Gateway to Happiness, pp.252-3)