Andy Murray, of Britain, returns the ball against Denis Shapovalov, of Canada, during their match at the Mutua Madrid Open tennis tournament in Madrid, Spain, Tuesday, May 3, 2022 (AP)
The announcement came not long before Murray was scheduled to take the court against the top-ranked Djokovic in the third round.
It would have been the first time Murray and Djokovic played against each other since Djokovic won the Doha final in 2017.
Murray had won his first two matches in Madrid, defeating Dominic Thiem and Denis Shapovalov. The former No. 1 hadn't won consecutive matches since January and hadn't played in a clay-court tournament in nearly two years.
Ranked 78th in the world, the 34-year-old Murray has been making his way up the rankings since having hip surgery in both 2018 and 2019. He had arrived in Madrid with a 10-8 record in eight tournaments. He lost the Sydney final to Aslan Karatsev in January.
There were no further details on Murray’s illness. He had said after the win over Shapovalov that he was feeling fine physically.
With Murray's withdrawal, Djokovic automatically advanced to the quarterfinals — his second of the year after losing the Serbia final last month. He had lost in his first match in Monte Carlo in his first tournament on clay this season.
Djokovic is also trying to regain his best form after not being allowed to play in the Australian Open because he was not vaccinated. This is only his fourth tournament of the season. The Serb opened in Madrid with a two-set win against Gael Monfils.
Third-seeded Rafael Nadal, in his first tournament after a six-week injury layoff, takes on David Goffin, while Spanish sensation Carlos Alcaraz, celebrating his 19th birthday, faces Cameron Norrie.
Andrey Rublev, who beat Djokovic in the Serbia final, plays Daniel Evans, while defending champion Alexander Zverev meets qualifier Lorenzo Musetti. Fourth-seeded Stefanos Tsitsipas faces Gregor Dimitrov.
In the women's semifinals, eighth-seeded Ons Jabeur faces qualifier Ekaterina Alexandrova, while 12th-seeded American Jessica Pegula meets Jil Teichmann.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)