The 39-year-old American revealed her decision at her pre-Wimbledon press conference but refused to divulge the reasons for her decision.
However, a ban on foreign fans as well as family members at the Olympics would have meant Williams being separated from her daughter Alexis Olympia.
The Olympics have already been delayed by a year and organizers have been forced to introduce strict measures to fight COVID-19.
Williams is the joint-most successful Olympian in tennis history in terms of gold medals alongside her sister Venus, having won one gold medal each in singles and three in doubles.