Williams said she couldn't "physically serve" with the pectoral problem, adding she felt the injury during her third-round singles match against Julia Goerges on Saturday and during Sunday's doubles tussle with older sister Venus.
"I unfortunately have been having some issue with my pec muscle", the tournament's press office quoted Williams as saying.
"It is hard to play when I can't physically serve".
The French Open marked only Williams' third tournament of 2018 - and first since March - after she gave birth to daughter Olympia in September.
Williams' withdraw is just another similarity she shares with Sharapova.
The possibility of Williams facing Sharapova had been grabbing attention since the draw was made at Roland Garros 10 days ago. "The first time I felt it was against Görges in my last match".
Despite her win, as Williams approached the final round, it appeared increasingly hard for her, although spectators and fans continued to cheer her on.
First Lady Melania Trump says she's 'feeling great'
Has she moved back to New York City? Trump delivers remarks on his intentions regarding the Iran nuclear deal at the White House . Trump capped it off in early May with a splashy Rose Garden rollout for her "Be Best" campaign to teach kindness to children.
Korean official holding full day of meetings in NY
However, Trump on Thursday conceded for the first time that the negotiations with Pyongyang might require more than one summit. US Secretary of State Mike Pompeo (2nd L) holds talks with North Korean envoy Kim Yong-chol (2nd R) in NY , on May 31, 2018.
Corona girl advances to final rounds of national spelling bee
Karthik ended up beating 12-year-old Naysa Modi, who lives about 15 miles away and topped him at their county spelling bee. Moreover, a change in how spellers were invited to this year's bee drew hundreds more spellers than in past years.
However, the 23-time Grand Slam victor will now have to focus on making a recovery in time for the start of the grass-court season. "It's a match I always get up for". I tried a lot of different tapings and support.
"So I'm going to get an MRI tomorrow".
But many fans feel this latest inquiry fired at Serena - which is now a moot point since she dropped out of the French Open earlier today because of an injury - is probably the most preposterous. It didn't get a lot better. Williams also is not sure when she will be able to return to action, leaving her Wimbledon status in doubt with just a month before the next slam begins.
"I think Serena can get close to winning another Grand Slam. It hasn't been easy", she said.
The big question here is whether Williams will be ready by Wimbledon, which presents her best chance to win what would be a record-tying 24th major.
In his article, he wrote: "I asked Serena about comments President Donald Trump made to me in 2004 about her and Maria Sharapova". Her opponent will advance to the quarterfinals.
The Russian, a two-time French Open champion, will face either 2016 victor Garbine Muguruza or Ukraine's Lesia Tsurenko in the last eight. "I've pretty much had every injury in the book [but not this]", she said.