US Open tournament director David Brewer announced Sharapova's exit, which allowed qualifying lucky loser Daria Kasatkina of Russia into the draw in Sharapova's place.
"Unfortunately I will not be able to compete in this years US Open," Sharapova said in a Twitter posting yesterday.
"I have done everything possible to be ready but it was just not enough time. To all my amazing fans, I will be back in the Asian swing in a few weeks and look forward to finishing the year healthy and strong."
Sharapova had been the highest-seeded rival in Williams' half of the US Open draw, a status that now belongs to seventh-seeded Serbian Ana Ivanovic, a possible semi-final foe for the 33-year-old American.
Williams is trying to complete the first Grand Slam calendar-year title sweep since Steffi Graf in 1988 and match Graf's Open Era-record of 22 Slam singles crowns.
Sharapova had not played a match since losing to Williams in a Wimbledon semi-final last month because of the injury, which she said had been a day-to-day thing since it happened.
"Dealing with these nagging things, it's almost like a day-to-day process," Sharapova said on Saturday.
"When you are facing something with the body it's always a day-to-day process."
Williams is 18-2 all-time against Sharapova and has won their past 17 meetings in a row. Prior to pulling out of the tournament for the second time in three years, Sharapova described the injury as "just a muscle strain".
"I've done everything I could to be ready," Sharapova said. "There's nothing more that I could have done."
Sharapova did make the publicity rounds in the days before the US Open, including a photo shoot with a New York taxi and many of her rivals that noted her position at the front, well away from Williams and ex-boyfriend Grigor Dimitrov.
"Time-wise it has been the same for me as it has the last seven or eight years," said Sharapova of her publicity outings.
The 28-year-old Russian had been tweaking her tournament schedule in the past few weeks in order to give herself a chance to come back on the Flushing Meadows hardcourts, knowing that pulling out of tuneup events in Cincinnati and Toronto would hurt her chances in New York.
"It's always the adjustment of being a professional athlete in a sport that requires many weeks out of the year to compete at a high level," Sharapova said.
"Don't always know where some things come from but sometimes you have to make adjustments to be healthy and ready for the big ones. It only gets tougher as you get older."