It looked much worse in the second as Djokovic's movement was limited with Raonic bouncing back with a break to take a rare set off the Serbian superstar.
As Raonic broke at 3-2 in the second set Aussie tennis star John Millman said "this is absolute panic stations".
Raonic has never beaten Djokovic with the record out to 12 matches between the pair, while the Canadian has taken just four sets in their battles.
But in the third set, Djokovic blew Raonic away, taking the final five games of the set to win the third set 6-1.
While it went on serve in the fourth until the ninth game of the set, Djokovic powered over the line to snatch the result.
The World No. 1 said he "used every single hour that I had since I finished the last match against Taylor to recover, to try to put myself in a position where I have a possibility to compete".
"If it's any other tournament than a Grand Slam, I would retire, withdraw from the event, that's for sure," he said post-match. "But because it's a grand slam and, you know, I want to give my best alongside with my team to try to recover and trying to get on the court, obviously I didn't know before I finished my warm-up today, three hours before I entered the court against Milos here whether I'm going to play or not.
"When it warmed up, it was fine. Obviously during the match today it was kind of on and off. It's not ideal, but I cannot complain, you know. I won the match against a great player and, you know, hopefully it's going to be even better in two days. So let's talk about the next match."
Djokovic also told Eurosport that he got through the match with painkillers.
"If I wasn't in the condition, I'd pull out. There was a big cloud of doubt whether I was going to play or not… I'm not really sure whether it suited me that we didn't have long exchanges – it probably did," he said.
"Right now, in my head, it's all about recovery. I just really want to try and feel better and better. I'm under pain killers for more than 48 hours, very strong ones. I don't know the damage that's been done. There's always more damage."
But after some incredible play throughout the game, the world is still puzzled about the injury.
Earlier, US Open champion Dominic Thiem has been completely outclassed by Bulgarian rival Grigor Dimitrov in a major upset on Rod Laver Arena.
Naomi Osaka's showdown with red-hot Spaniard Garbine Muguruza was promoted as the match of the day and it delivered in dramatic fashion.
Meanwhile, Serena Williams qualified for the quarter-finals after a closely-contested clash with Aryna Sabalenka on Rod Laver Arena.
Ash Barty is the only remaining Aussie remaining in the singles competition, while Nick Kyrgios and Thanasi Kokkinakis lost their doubles clash on Margaret Court Arena.