Ultimately all sickness stems from karma (which refers to both actions and their effects).

What we term “karmically caused illness” differs from ordinary illness, however, in that it does not respond to treatment, or if it does, a new disease soon replaces it.

Medicines that work for others prove ineffective, and one affliction after another undermines one’s well-being.

If one seeks spiritual guidance because the doctors have failed, a lama might suggest doing purification practice or saving the lives of others (bait worms or shrimp, for example). After some practice, one might finally find the right medical treatment, or the illness might simply abate with no other treatment.

With very stubborn illnesses or in terminal cases, purification practice offers reassurance that in future lifetimes one will not confront the results of that same karma.

Some years ago, a woman in Switzerland opened her private interview with Chagdud Rinpoche by stating, “I have cancer. Two operations have failed to cure it, and now I am going to die.” She said this with no emotion whatsoever and Rinpoche did not contradict her.

He only suggested that purifying karma would benefit her preparations for death. She accepted this, so he gave her a Red Tara practice, and a generous Swiss student offered her a place to do retreat for a month or two.

Rinpoche never saw her again, but later learned that she did indeed do a very diligent retreat, that all of her symptoms disappeared and she lived on for years.

In delineating what to abandon and what to accept, Buddhist doctrine categorizes karma into the ten non-virtues and ten virtues.

Source: Tromge, Jane. Ngondro Commentary: Instructions for the Concise Preliminary Practices of the New Treasure of Dudjom. Compiled from the teachings of H.E. Chagdud Tulku Rinpoche by Jane Tromge. Junction City, CA: Padma Publishing, 1995.

Reflection:
There once was a woman named Kisa Gotami, the wife of a rich businessman, whose infant son fell ill and died.
Kisa Gotami was overwhelmed by grief and could not accept the death of her child. She carried the baby around her village asking if there was anyone who had medicine that could heal him.

One kind person said, “I know of a great physician,” and sent her to see Buddha Shakyamuni. Kisa Gotami took her child before Buddha Shakyamuni and requested that the Buddha give him medicine that would heal him from illness.
The Buddha said, “I will give you the medicine you request, but first you must bring to me a mustard seed from the home of a family where no one has lost a loved one.”

Kisa Gotami was eager for her son to be healed, so she went from door to door asking for a mustard seed. At first, no one refused her request. They were happy to give a seed to heal a sick child.
However, before taking the mustard seed she said, “I must receive the mustard seed from a home where no family member or loved one has died.”

And then no one was able to give it to her. After some time, Kisa Gotami realized what the Buddha was trying to tell her. She came to understand that death is a part of life, and there is no person unaffected by the experience of death.
She buried her child and gave up worldly life altogether, becoming a student of the Buddha and eventually attaining a highly realized state.
(Anyen Rinpoche and Allison Choying Zangmo. Living and Dying with Confidence: A Day-by-Day Guide.)