The 19-year-old from Belarus was one of three players who had to withdraw from fourth-round matches on a sunny but mild day in Melbourne, with temperatures hovering around 75 degrees.
The second-seeded Williams was up a service break at 4-2 in the second set after No. 13 Azarenka had won the first set 6-3.
Azarenka, serving at 30-30, wobbled back into the shade at the rear of the court, holding her face and choking back tears as she tried to regather herself.
She had needed a medical timeout earlier in the set and left the playing arena. She returned for 1½ games but was unable to continue and was helped from the court soon after by two trainers.
"I just want to go inside and make sure she's OK. I feel so bad. She was playing so well," Williams said in an on-court interview. "There are so many more great Australian Opens out there for her."
Officials said Azarenka was suffering from dizziness and a vomiting virus.
"Honestly, I got worried," Williams said. "She started walking really slow. The last thing she would want to do, to me, would be fall. It was just weird. I was actually really worried."
Williams, seeking a 10th Grand Slam singles title, next plays 2004 U.S. Open champion Svetlana Kuznetsova, who advanced when Zheng Zie of China retired at 4-1 in the first set.
No. 22 Zheng injured her left wrist when she tumbled after the third game. She had treatment immediately but retired two games later.
The winners of the two completed women's matches meet in the quarterfinals.
She next plays Olympic gold medalist Elena Dementieva, the No. 4 seed from Russia who made the quarterfinals for the first time in 11 years at Melbourne Park with a 6-2, 6-2 win over Slovakia's Dominika Cibulkova.
Azarenka was taking the match to Williams, with both women going for winners constantly.
Williams was looking quicker on her feet than in her last two matches, but her first serve was another matter.
Clearly trying to concentrate, she regularly was bouncing the ball 20 times -- she once hit 37 -- before making her toss.
At 3-5 in the first set, Williams double-faulted for the second time to give Azarenka a set point, then loudly cursed her first serve, earning a warning from the umpire for an audible obscenity and sending a backhand long on the next point.
Things got better for Williams as she saved three break points in her opening serve of the second set in a game that went to deuce five times, then broke Azarenka to pull ahead at 2-1, shouting "Come on!"
Azarenka appeared to become ill after pulling within 3-2 and went off court. Williams took advantage of the time to get her ankles retaped.
"The doctors didn't want me to keep going, but I wanted to keep trying and see how I do," Azarenka said. "But it was probably not a very good idea because it just gave me even more trouble after."
Serena Williams, who has won the Australian title in 2003, 2005 and 2007, and Kuznetsova are the only major winners still in the women's draw.
Suarez Navarro is into the quarterfinals in her first trip to the Australian Open and second time overall, after reaching that round as a qualifier in the French Open.
The fourth-seeded Dementieva, who reached the finals at the French and U.S. Opens in 2004 but has not been to a Grand Slam championship match since, extended her winning streak to 14 matches. She won two titles in tuneup events.
Dementieva was ousted in the quarterfinals at the French last year and reached the semifinals at Wimbledon and the U.S. Open.