The Australian, seeded 15th, defeated Novak Djokovic in the previous round, and was expected to be involved in one of the matches of the tournament against the Swiss, who recently claimed the first Grand Slam title of 2017.
Kyrgios released the following statement:
"At this stage we think it is food poisoning and I am praying it is nothing more. After a restless night of being sick, I have nothing left and to play a great champion Roger, I need to be at my best to have a chance.
"I do not take this decision lightly, these are the matches that we train for but I am in no fit state to take the court.
"I am sorry to the fans that I am unable to take to the court but I have to put my health first and I hope that you understand. I want to wish Roger the best of luck for the rest of the tournament and thank everyone for their support so far here at the BNP Paribas Open. I will definitely be back. Thank you."
Federer, who will take on Jack Sock in the semis, wished Kyrgios well via social media:
American Sock caused an upset in the last-eight, defeating Japan's Kei Nishikori 6-3 2-6 6-2 to reach his first Masters 1000 semi.