The 33-year-old Swiss, who spent nearly three hours late on Saturday beating compatriot Stanislas Wawrinka in a gruelling semi-final, announced his decision on court as the O2 Arena filled up for the expected final.
Federer, who was bidding for a seventh title at the year-ender, apologised but said he was not "match-fit" after developing a back problem.
"I hope you understand I wanted to come out personally and excuse myself for not playing ... I can't compete without a back at this level," he told the crowd who still warmly applauded, despite their obvious disappointment.
ATP president Chris Kermode, standing alongside Federer, then announced that Andy Murray, who failed to qualify for the semi-finals after being thrashed by Federer on Thursday, would play Djokovic in a one-set exhibition match instead.
Federer hopes to play for Switzerland against France in the Davis Cup final which starts on Friday.
Image: Novak Djokovic of Serbia poses with the ATP trophy on day eight of the Barclays ATP World Tour Finals at O2 Arena
Photograph: Julian Finney/Getty Images
ATP Tour Finals: Federer fights back to set up Djokovic showdown
McEnroe terms Djokovic one among 'all time greats'
World Tour Finals: Djokovic halts Nishikori fightback to reach final
Djokovic trounces Berdych at Tour Finals, seals No.1 spot
CTL promises an exciting brand of tennis