The Wales back-rower had not played since leading the Lions tour of New Zealand in 2017, undergoing knee and neck surgery in the hope of making a return to action.
The 29-year-old, who won 79 Test caps, recently returned to pre-season training with Cardiff Blues, but has decided to call it a day after realising he would not be able to return to the high standards he has set throughout his career.
"My body is unable to give me back what I had hoped for on my return to training," said Warburton.
"Unfortunately, after a long period of rest and rehabilitation the decision to retire from rugby has been made with my health and wellbeing as a priority."
Wales and Lions coach Warren Gatland added: "He is an outstanding rugby player and he has brought so much to the game on and off the pitch.
"His leadership, attitude and demeanour along with his performances have placed Sam up there as one of the best and most respected players in the world.
"He finishes with a record that he should be extremely proud of and should look back on his career with huge pride."