The American, who turned 39 this week, had been due to play Bulgarian Tsvetana Pironkova in the second round later but after a warm-up decided the injury was too severe.
Williams, a three-time former champion at Roland Garros, said she may not play again this year.
Williams had suffered the problem during her semi-final loss to Victoria Azarenka in the U.S. Open and said ahead of her Roland Garros campaign that she was not at 100% physically but had recovered sufficiently to play.
Since Williams resumed her career in 2018 after a maternity break she has remained tantalisingly one behind the record 24 Grand Slam titles claimed by Australian Margaret Court.
She lost in the Wimbledon and U.S. Open finals that year, as she did in 2019.
Meanwhile Victoria Azarenka's unhappy French Open campaign ended as the former world number one was beaten 6-2 6-2 by Slovakia's Anna Karolina Schmiedlova in the second round.
The Belarussian, who moaned about the cold and damp conditions in her opening round win, capitulated in feeble fashion against her 161st-ranked opponent.
Tenth seed Azarenka was runner-up at the U.S. Open last month.
Top seed Simona Halep of Romania put in a disciplined performance to tame big-hitting compatriot Irina-Camelia Begu 6-3 6-4, extending her winning run to 16 matches.