In an interview with French outlet L'Équipe the 41-year-old revealed that a routine operation on his knee in his final season led to him almost losing his leg due to a flesh-eating infection.
Ribery said: "My knee hurt more and more. I was no longer training between matches but rather recovering to protect myself.
"I went under the knife in Austria. The operation went well, with a plate inserted inside. But I had a bad infection almost five months later.
"They removed the plate, but the infection had eaten away at me. It was so bad that I had holes in my leg. I had contracted Staphylococcus aureus.
"I was in the emergency room at the hospital in Austria for 12 days. I was really scared. They could have cut off my leg."
The ex-winger retired in 2022, ending his trophy-laden career in the Serie A with Salernitana.