His most recent Grand Slam title was the 2018 Australian Open, but he made it to the French Open semifinals and Wimbledon final a year ago, before losing, respectively, to eventual champions Nadal and Djokovic.
Federer, a six-time Australian Open champion, missed out on his huge first set chances and paid the price for it as the second-seeded Serb won 7-6 (1) 6-4 6-3.
In order for Federer to capture his third Australian Open championship in four years, that skid will need to end Thursday.
He then had three break points to lead 5-1 however Djokovic recovered, broke back and won the first set in a tiebreak.
The 20-time major winner's record of never retiring from an ATP match was in doubt due to a groin injury suffered in his quarter-final miracle win over Tennys Sandgren.
Federer received the code violation in the third set of his match against Sandgren when a lineswoman reported Federer to the umpire, Marijana Veljovic, who issued the warning.
He certainly would not have wanted to take a heavy beating in his 50th clash with Djokovic and first at a grand slam since he was unable to take two match points in last summer's dramatic Wimbledon final.
Violent clashes continue in Lebanon over finance woes, fractured government
Security forces and the military were girding themselves for more violence, following protester calls for more rallies on Sunday. Lebanon's Internal Security Forces (ISF) urged people to remain calm and said otherwise it would be forced to repel them.
While Federer hung in there as best he could for sets two and three, Djokovic's relentless pressure eventually told as he improved his record against the Swiss to 27-23 overall and 11-6 at Grand Slams.
"The timeout today was just one of the things that need to be done to prevent any further problems, and once I was back in the match I felt I was probably going to able to finish which was a good thing". "Didn't know that. Next time I got to check the linespeople". "I think it's normal", he said.
"Nice entrance, nice send-off, and in between is one to forget, because you know you have a 3% chance to win".
"Once you can see it coming, that it's not going to work anymore, it's tough", he said, adding: "I don't think I would have gone on court if I had no chance to win".
"At the end of the day I'm very happy", he said.
Home hope Ashleigh Barty was upset in the women's semi-finals by 21-year-old American Sofia Kenin, and she will take on Garbine Muguruza for the trophy after the Spaniard defeated Simona Halep.
Victory for Djokovic on Sunday would hand him his 17th Grand Slam title. I think I returned really well in the beginning.