The answer to that is easy - Fear!
After three hospital experiences in just over six months, I decided that being healthy beats being incapacitated hands-down. It may sound very melodramatic to say I had to decide whether to eat Big Macs and Fries or walk, but it may have come down to that.
Don't get me wrong, I was in perfect health despite being morbidly obese, but I came to realize I couldn't cheat the consequences of abusing my body for ever. I needed to quit while I was ahead.
I don't live with that fear, or lay awake at night in a cold sweat, but thankfully it got me into the right gear.
Whatever it was for you, keep trucking!