In the prequels and Clone Wars, Yoda is a spry and agile 870 year old. In just a short amount of time in Yoda-years he becomes feeble and decrepit, then suddenly dies. What makes a Yoda suddenly (in Yoda-years) become sickly and weak?
Yoda is OLD. In his fights in the prequel trilogy, he draws heavily on the Force to sustain himself and enhance his speed, strength, etc.
This is seen quite obviously when he pauses to pick up his cane after the fight with Dooku, and mentioned in multiple Expanded Universe (since rebranded 'Legends') works (not always specific to Yoda).
On Dagobah, Yoda avoids using the Force as much as possible. He is there to hide his immense Force presence, masking it with the Dark Side presence of the cave. Thus, he doesn't extensively use his abilities - it could give him away. He is still relatively spry. Despite this, he is tired and worn out. Life in a swamp, especially if you've been used to the conveniences of a modern (or post-modern) world your whole life, is VERY difficult. Simple survival is a challenge.
By the third movie, he has become ill. He lives in a swamp, it happens. He is likely feverish, which affects his ability to concentrate, and his body is finally breaking down. He is also ready to go at that point - his final student has graduated, his tasks are all but complete, and there is essentially nothing left he can do to change what will happen.
He was so old and the conditions where he lived last 40 years were bad. Disappointment and awful life conditions reduces his life time.
The unbalance in the force caused him to become agile and sick.
That's how I figured it.
Edit: After thinking about the answer I gave to another question, I would say that Yoda got weak after the balance from the force shifted away from the Light Side and towards the Dark Side and with his age.