The temperamental Australian took to twitter barely an hour before the scheduled start time at Indian Wells in California to make the announcement.
"I'm so sorry but I can't play today," he said. "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 these decisions lightly, these are the matches we train for, but I'm in no fit state to take the court."
Australian Open champion Federer and big-serving Kyrgios have been the two most impressive players through the early rounds this week, and fans were anticipating a classic match.
World number 16 Kyrgios blitzed his way to the quarters, taking out among others defending champion Novak Djokovic, the second time in less than a fortnight that he beat the Serbian world number two.
Federer advanced to the semi-finals where he will take on American 17th seed Jack Sock, who powered past fourth seed Kei Nishikori 6-3, 2-6, 6-2.
The evergreen 35-year-old Swiss said Kyrgios has an unlimited future, if his heart and mind ever match his physical talent.
Kyrgios beat Federer at their only career meeting in 2015.
"I love his first serve," Federer told ESPN. "He hits the lines at will, all directions, on both sides of the court. He can move well for a bigger guy.
"Now it all matters for his mind, his will, his heart, his legs, if he's willing to put it in day in and day out. That's the big question."
Image: Nick Kyrgios
Photograph: Clive Brunskill/Getty Images