The unseeded Williams was scheduled to meet 22nd-seeded German Sabine Lisicki in a second-round match on Day 3, but Lisicki, instead, received a walkover into the round of 32.
Williams said she has been diagnosed with Sjogren's Syndrome, which is a disease that creates fatigue and joint pain.
The 31-year-old Williams has battled injuries for most of this 2011 season and hadn't played any tennis since losing in the fourth round at Wimbledon last month before returning with an easy opening-round victory against Russian Vesna Dolonts here on Monday night. She was sidelined with what she thought was a viral illness for the last month-and-a-half.
"I enjoyed playing my first match here and wish I could continue, but right now I am unable to," Williams said in a statement. "I am thankful I finally have a diagnosis and am now focused on getting better and returning to the court soon."
The former world No. 1 and seven-time Grand Slam champion titled here back-to- back in 2000 and 2001 and is also a two-time runner-up in Flushing. She reached the semifinals here a year ago.
The rising Lisicki is fresh off her hardcourt title in Dallas last week and was a Wimbledon semifinalist last month.
"I was really looking forward to the match," Lisicki said. "I love those big matches and playing against Venus. We had two amazing matches the last two meetings. I was really looking forward to it."
Sharapova, seeded third, saved all five break points she faced and breezed to a 6-1, 6-1 win over Anastasiya Yakimova of Belarus in the final match of the night. The former world No. 1 Sharapova, who titled in Cincinnati two weeks ago, is a former world No. 1 and three-time Grand Slam champion, including a U.S. Open title in 2006.
Also on the court Wednesday, last year's U.S. Open runner-up Vera Zvonareva posted a second-round win. The second-seeded Russian snuck past Ukrainian Kateryna Bondarenko 7-5, 3-6, 6-3 on another beautiful day at the USTA Billie Jean King National Tennis Center. Zvonareva survived in 2 hours, 7 minutes despite amassing 46 unforced errors.
"I think I didn't play my best tennis, but I managed to go, to get through this one," Zvonareva said. "I gave myself another chance to go out there and next time and try to do a little bit better."
Zvonareva was dismantled by Belgian star Kim Clijsters in last year's U.S. Open finale and was also the runner-up at Wimbledon in 2010.
Up next for the Russian star will be Spaniard Anabel Medina Garrigues.
A big Day-3 upset came when American teenager Christina McHale upended eighth- seeded Frenchwoman Marion Bartoli 7-6 (7-2), 6-2. McHale, who played in front of a contingent of family and friends in the stands on Wednesday, is a promising 19-year-old from New Jersey.
"I'm so excited to have beaten a player like Marion, especially have it happen here at the U.S. Open," said an elated McHale.
The 26-year-old Bartoli is a former Wimbledon runner-up who reached the French Open semis this year and has appeared in four finals this season, including a title at a Wimbledon tuneup in Eastbourne back in June.
Other upsets on the day came when Germany's Angelique Kerber dispatched No. 12 seed Agnieszka Radwanska of Poland, 6-3, 4-6, 6-3; American Irina Falconi took down 14th-seeded Slovakian Dominika Cibulkova 2-6, 6-3, 7-5 and Russia's Alla Kudryavtseva got past Belgium's 20th seed Yanina Wickmayer 6-1, 3-0, retired. Wickmayer retired from the match with a back injury.
Ninth-seeded former French Open runner-up Samantha Stosur avoided an upset by topping American teen Coco Vandeweghe 6-3, 6-4, while 13th-seeded Chinese Peng Shuai cruised past Bulgarian Tsvetana Pironkova 6-2, 6-4, and 19th-seeded German Julia Goerges grounded Spaniard Laura Pous-Tio 6-3, 6-1.
Meanwhile, 24th-seeded Russian Nadia Petrova handled Slovenian Polona Hercog 6-2, 6-4; 25th-seeded Maria Kirilenko leveled fellow Russian Vera Dushevina 6-1, 6-2; 26th seeded Italian Flavia Pennetta cruised past countryman Romina Oprandi 6-0, 6-3; 27th-seeded Czech Lucie Safarova overcame 16-year-old Illinois native Madison Keys 3-6, 7-5, 6-4; and a 30th-seeded Medina Garrigues grounded Britain's Laura Robson 6-2, 6-3 at the year's final Grand Slam event.