The Etixx-Quick Step man had made it all the way to the circuits on the Champs Élysées before pulling off the course and heading straight to his team bus.
Martin said the pain, which began on Saturday's 146km stage 20 through the mountains from Megève to Morzine, was just too much to able to keep up with the fast pace of the peloton on final Paris circuits.
The German then headed straight home to try and discover exactly why the pain had started, with no obvious explanation for it, as he prepares for the Olympic time trial in Rio at the start of August.
"Due to severe knee pain yesterday unfortunately I had to prematurely end the Tour." Martin explained on Monday on his Facebook page. "I'm really disappointed. It's never nice in a race to have to get off.
"Yesterday I absolutely wanted to start, so that I could help Marcel as much as possible in the finale.
"But after only 20 kilometres I knew that I couldn't do it, the pain was simply too much. The relaxed ride up to the Champs Élysées was good for me, but then I turned off directly to the bus.
"The pain started on Saturday and came out of the blue. So far we still have no explanation for it. Maybe an overload, maybe a reaction to the slightly cooler temperatures through the rain.
"I will use the next few days to try and figure out the cause and see that I can fully use the knee again."
The 31-year-old, who is aiming for gold in the time trial at the Olympics in Rio after taking silver in 2012 behind Bradley Wiggins, says that it was always the plan for him to leave the final stage of the Tour straight away anyway in preparation for the Games, and he did not miss out on the celebrations with his team because of the injury.
"Meanwhile I am home again," he added. "I left directly after the stage. That was not because of my exit from the race, but had been planned all along with an eye to Rio and my further preparation.”
A five-time stage winner in the Tour, Martin wasn't able to take a stage this year despite two time trials along the course. He was able to help Marcel Kittel to a single stage win on stage four of the race, as well as helping Irishman Daniel Martin to a ninth place finish overall.
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1