The world No. 4, who had pledged his allegiance to Ireland for the Games, announced in a statement that he will not be available.
McIlroy is one of a number of high-profile golfers to pull out, with Adam Scott, Louis Oosthuizen, Charl Schwartzel, Marc Leishman and Vijay Singh having already said they will not travel to Brazil, while world No. 6Rickie Fowlerhas also cast doubt on his participation.
"After much thought and deliberation, I have decided to withdraw my name from consideration for this summer's Olympic Games in Rio de Janeiro," McIlroy said in a statement. "After speaking with those closest to me, I've come to realise that my health and my family's health comes before anything else.
"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. I trust the Irish people will understand my decision. The unwavering support I receive every time I compete in a golf tournament at home or abroad means the world to me. I will continue to endeavour to make my fans and fans of golf proud with my play on the course and my actions off it."
The situation is a blow for the sport as golf returns to the Olympics for the first time since 1904.
World No. 1 Jason Day described McIlroy's decision to skip the Rio Olympics as "understandable" and added that he hasn't made a decision himself if he'll play for Australia this August.
"I respect his decision because, obviously, it's a tough one going from trying to represent your country and trying to win a gold medal, but also understanding that it's a life decision that you have to make -- just in case there's a small percentage that (contracting the Zika virus will) happen," Day said Wednesday at Baltusrol Golf Club, where he will defend his PGA Championship title at the end of July.
"But it's a decision that some people aren't willing to take. I haven't made a decision yet because obviously I just finished the U.S. Open. Then obviously this came out this morning, so I knew this was going to be a hot topic today.
"I'll talk to Bud (Martin, my agent) and family members because family for me is priority No. 1, so I want to make sure that they're happy and then from there I'll make a decision."
The Olympic Council of Ireland (OCI) said it was "extremely disappointed" that McIlroy would not be going to Rio, but "we respect his decision."
The International Golf Federation also released a statement on Wednesday: "The IGF is disappointed with Rory's decision but recognises that some players will have to weigh personally a unique set of circumstances as they contemplate their participation in golf's historic return to the Olympic Games in Rio de Janeiro, with the Zika virus foremost among them.
"It is unfortunate that the Zika virus has led to Rory's decision to withdraw from the Olympic Games, knowing how much he was looking forward to taking part."
Concerns about the Zika virus, which has been linked to birth defects, have cast a shadow over Rio 2016, but the International Olympic Committee, with guidance from the World Health Organisation, has resisted calls for the Games to be moved or postponed.
"The OCI and our medical team have taken our lead from the IOC on the Zika situation, as we do in all matters," the OCI statement said. "They have provided us with every assurance and we have total confidence that the Games will be safe for all athletes.
"We are now following the IOC's recommendations, as well as the recommendations of the Rio 2016 organisers, the World Health Organisation and national health authorities, to ensure that Team Ireland's athletes are kept fully updated with the latest and best advice and that they are equipped to take all necessary precautions.
"The OCI is leaving no stone unturned in ensuring the welfare of Team Ireland's athletes at Rio 2016."
The Press Association contributed to this report.
Golic: McIlroy doesn't need the Olympics
Mike Golic doesn't think that an athlete like Rory McIlroy pulling out of the Olympics will make a big difference because winning a gold medal isn't McIlroy's No. 1 priority.
McIlroy withdraws from Rio Olympics
Alex Perry looks at what Rory McIlroy's decision to miss the Olympics over Zika concerns might mean for golf at the Games.