In a statement released by his management company on Wednesday, the four-time major winner says "I've come to realize that my health and my family's health comes before anything else."
The Northern Irishman says "even though the risk of infection from the Zika virus is considered low, it is a risk nonetheless and a risk I am unwilling to take."
McIlroy is one of the most high-profile sports stars to pull out of the Rio Games because of Zika, the mosquito-borne virus linked to severe birth defects and possible neurological problems in adults.
Ireland's Olympic council said in a statement that it was disappointed, but expressed understanding and hope that McIlroy's absence could provide an opportunity for another golfer.
"Rory was set to be one of the big stars of Rio 2016, but now there is an opportunity for another Irish golfer to take up the chance to become an Olympian and participate in golf's historic return to the Olympic Games after a 112-year absence," said the Olympic Council of Ireland.