Federer went through to the semifinals of the US tournament without hitting a ball, after the young Australian withdrew because of illness.
Just hours before the pair were scheduled to meet Friday at the BNP Paribas Open, Kyrgios announced on social media he had been sick overnight.
"At this stage we think it's food poisoning and I'm praying it's nothing more," the 21-year-old said in a statement.
"After a restless night of being sick I have nothing left and to play a great champion like Roger I need to be at my best to have a chance.
"I don't take this decision lightly. These are the matches we train for but I'm in no fit state to take to the court."
World No. 16 Kyrgios apologized to fans, but hoped they understood he had to "put my health first."
Bad boy turned good?
Kyrgios had played 18-time grand slam champion Federer only once before, beating the Swiss great on clay at the 2015 Madrid Masters.
The Australian has something of a bad-boy reputation on the circuit, but had been in fine form of late, defeating world No. 2 Novak Djokovic for the second time in three weeks to set up a clash with Federer at the hard-court event in the Californian desert.
He was fined and banned
for eight weeks by the ATP World Tour for failing to "give best efforts" in Shanghai in October, and he crashed out of the Australian Open
in the second round in what was tagged a "bizarre" performance.
However, his wins against Djokovic -- the first in the quarterfinals of the Mexican Open -- suggested he could have turned a corner.
Kyrgios, who beat the Serb 6-4 7-6 (7-3) this week, was aiming to make his third consecutive ATP Tour semifinal.
"I'm very impressed with him taking out Novak, back-to-back weeks, on Novak's best surface," Federer said after reaching the last eight.
"I hope it's going to lead to something great for Nick, that he realizes if he puts his head down and focuses that he can bring it, day in and day out, week in and week out."
Federer, who booked his quarterfinal place with a straight-sets defeat of Rafael Nadal in a rematch of the Australian Open final
, will now play either American Jack Sock or Japanese fourth seed Kei Nishikori in Saturday's semifinals.
His 6-2 6-3 win over Nadal was the first time he had beaten the Spaniard three times in a row, after the five-set triumph in the Australian Open and victory in the 2015 Basel final.