The 17-time Grand Slam champion said he hurt his back in the nearly three-hour semifinal win over Davis Cup teammate Stan Wawrinka on Saturday night in which Federer saved four match points.
"Unfortunately I'm not match fit," the 33-year-old Swiss told the crowd at the O2 Arena. "I tried everything I could last night, also today: painkillers, treatment, rest, so forth, warm-up, until the very end. But I just can't compete at this level with Novak. It would be too risky at my age to do this right now and I hope you understand."
Fans appeared to be supportive with applause for Federer when he spoke.
The Swiss is set to play for Switzerland in the Davis Cup final against France, starting Friday. If he recovers in time, Federer will be chasing the only major trophy still eluding him. France hosts the match in the northern city of Lille and has opted for clay, a slow surface that could further thwart Federer's chances to perform well.
"I don't think he was calculating and trying to save his body for Davis Cup final," said Djokovic. "This is probably the biggest match of the season next to the final of a Grand Slam. I spoke to him, it's a question mark for the Davis Cup final as well."
It was only the third time in Federer's career that he withdrew, each time due to a back injury, following walkovers in 2008 at the Paris Masters and in 2012 in Doha.
Following back problems that ruined his 2013 season, Federer enjoyed a superb resurgence this season, losing to Djokovic in an epic Wimbledon final and adding five new titles to his collection.
Federer, the most successful player at the ATP Finals with six wins, also made it to the semifinals at the Australian Open and the U.S. Open and won his 23rd Masters title in Shanghai last month. He remained on course for the year-end No. 1 spot until this week and had dropped just one set on the way to the final.
"I think you have some recurrent things coming back from time to time," the second-ranked Federer said. "It's not that much of a surprise. I must say I've been feeling really good for over a year now, which has been not a surprise, but it's been very nice. So this back spasm, whatever it might be, it's just not a fun thing to have during the day. It's just uncomfortable. But I'm positive and I'm hopeful that it's going to go away very soon."
Djokovic became the first player since Ivan Lendl from 1985-87 to win the year-end event three times in a row but was not in the mood for celebrations.
"You never like to win, especially these big matches against big rivals, with the retirement," said the four-time champion.
Unbeaten on indoor courts in more than two years, Djokovic finished the season No. 1 for the third time in four years, becoming the seventh man to accomplish the feat at least three times. Besides winning his seventh Grand Slam title at the All England Club, Djokovic was also runner-up at the French Open, and won six titles.
"Right now I'm at the pinnacle of my career," he said, adding that winning at Roland Garros would be one his main goals in future years. "I physically feel very fit. As long as it is like that, I'm going to use these years in front of me to fight for No. 1 of the world and the biggest titles in the sport."
Instead of facing Federer, Djokovic played an exhibition with Andy Murray before a doubles match pitting Murray and John McEnroe against Tim Henman and Pat Cash.
Federer's withdrawal marked the first walkover in a final in the tournament's 45-year history.