You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
It leaves the women's draw at the claycourt Grand Slam without its top two seeds following Naomi Osaka's earlier withdrawal.
Second seed Osaka, a four-time Grand Slam winner, pulled out after her first round following a row over her decision to boycott post-match media duties citing mental health concerns.
Australia's Barty, who lifted her maiden major at Roland Garros in 2019, was trailing 6-1 2-2 against Poland's Magda Linette when she decided she could no longer continue, having started the match with taping on her left thigh.
She had also struggled with the injury during her opening win and later said she suffered a flare-up through her left hip during the weekend.
"It's heartbreaking," Barty told reporters.
"We have had such a brilliant claycourt season, and to kind of get a little bit unlucky with timing more than anything to have something kind of acute happen over the weekend and just kind of run out of time against the clock is disappointing.
"It won't take away the brilliant three months that we have had, as much as it hurts right now."
Romanian world number three Simona Halep, the 2018 champion in Paris, also pulled out from this year's tournament due to a leg injury, meaning fourth-ranked Aryna Sabalenka of Belarus is the highest surviving seed this week.
The 25-year-old Barty's return to Roland Garros ended in disappointment after she opted to not defend her title last year amid the COVID-19 pandemic.
She had faced problems with her movement on court on Tuesday against Bernarda Pera but her physical condition improved against the American after receiving medical attention before the deciding set.
The top-seeded Australian called the trainer on court once again on Thursday after the first set, which she lost in just 27 minutes, hoping to be able to play on after receiving help.
She returned to Philippe Chatrier court after the medical timeout and played four more games before shaking hands.
Barty said she suffered the injury during training.
"It was a small miracle that we were able to get on court for that first round. Again, today it was no better and getting worse again," she said, adding that she hoped to be fit for Wimbledon which starts on June. 28.
"I just tried to give myself a chance and see how it felt. Obviously practising we've had our restrictions and essentially tried to stay as fresh as possible and not aggravate it in any way, but in a match that's unavoidable at times.
"Yeah, it got worse today and it was becoming at the stage where it was unsafe."