Seven orthopedic surgeries and years of chronic pain culminating in two total knee replacements in the past six months have made me realize it's time to move on, Alvarez, 55, said in a company announcement.
Alvarez, who joined McDonald's in 1994, also resigned from McDonald's board of directors, the company said.
Alvarez was one of McDonald's highest profile executives and was believed by many to be the top candidate to succeed current CEO Jim Skinner when he retires.
It was probably Ralph's job to give away. He's obviously in a lot of pain, said RBC Capital Markets analyst Larry Miller, who added that he recently saw Alvarez on crutches.
We're all very surprised, said Edward Jones analyst Jack Russo, who called Alvarez very well liked by the investment community.
Alvarez was not available for additional comment.
Analysts said McDonald's has had the unfortunate experience of dealing with unexpected changes to its top ranks and that the company has a deep management bench.
In 2004, McDonald's then-CEO Jim Cantalupo suddenly died of a heart attack. His successor, Charlie Bell, was diagnosed with colon cancer two weeks later and stepped down soon after.
Russo and Miller suggested that Alvarez's departure could open the door for one of the company's overseas presidents to climb the ranks, since the chain is increasing its global presence.
Among the names mentioned were Denis Hennequin, president of McDonald's Europe, and Tim Fenton, president of Asia, Pacific, the Middle East and Africa.
Shares in McDonald's closed up 29 cents to $63.54 on the New York Stock Exchange before the news was released, and were unchanged in after-hours trade.
(Reporting by Lisa Baertlein; Editing by Phil Berlowitz)