Flanker Warburton, who led the Lions on tours to Australia in 2013 and New Zealand last summer, underwent neck and knee surgery last year and has not played for 12 months.
The announcement was made jointly by the Welsh Rugby Union and Warburton’s regional team, Cardiff Blues.
“Unfortunately, after a long period of rest and rehabilitation, the decision to retire from rugby has been made with my health and well-being as a priority,” said Warburton. “My body is unable to give me back what I had hoped for on my return to training.”
Warburton won 74 Wales caps, captaining his country a record 49 times after being appointed ahead of the 2011 World Cup.
His final match was a drawn third Test for the Lions against New Zealand in Auckland last July. He returned to training with the Blues this summer after missing the whole of last season, but has now called it a day.
“Since I first played aged 10 at Llanishen Fach Primary School, I always dreamed of playing for my hometown club the Cardiff Blues, Wales and the Lions,” added Warburton. “I am extremely proud of what I’ve achieved.”
Warburton emulated England World Cup-winning captainin Martin Johnson in leading the Lions on two separate tours. Under his leadership, the Lions claimed a first Test series victory for 16 years when they beat Australia and then drew the series against reigning world champions New Zealand a year ago.
“There are so many people who helped me along the way from schoolteachers, coaches, friends and family,” said Warburton. “I thank them so much for supporting my dreams and aspirations. I hope they too can take some pride from my career.
“I would like the make special mention of (Wales head coach) Warren Gatland. Without the faith he had in me and his unwavering support, I would never have had the career I was able to pursue.
“As one chapter finishes, another begins, which I will enter with the same level of passion and determination as the last.”
He also steered Wales to the 2011 World Cup semi-finals - he was controversially sent off in the last-four clash against France - with Gatland appointing him as Wales captain and Lions leader, after heading up the Australia and New Zealand tours.
Gatland said: “It is hugely disappointing that Sam has retired from the game. He is an outstanding rugby player and he has brought so much to the game, on and off the pitch.
“His leadership, attitude and demeanor, 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.”