Williams trailed fellow seed Muguruza 6-3 1-0 when the 23-time grand slam champion retired.
"Before the match, I did not feel great, and then it just got worse with every second; extreme dizziness and extreme fatigue", Williams said in a statement posted by the tournament.
"I felt that maybe she wasn't feeling well", said Muguruza.
More blackouts hit Venezuela as opposition, government rally
More than 50 countries, including Germany, have recognized Guaido and support his plan to lead Venezuela to fair elections. Caracas is one of the world's most crime-ridden cities, so people set out for home early, well before the sun went down.
"It was just like, "man, we'll play next time". She is one of five players (out of 21 total) to reach No. 1 and not have a losing record against Williams. A two-time Grand Slam singles victor, the 25-year-old Spaniard now has a 3-3 record against Williams including a win in the 2016 French Open final and a loss in the 2015 Wimbledon final, but she said this victory didn't come with the usual sense of triumph.
Williams made a solid start to Sunday's contest in California as she raced into a 3-0 lead, the 10th seed dominating from the baseline with a string of powerful forehands. Next up for her is 18-year-old Bianca Andreescu who took an easier path into the round-of-16. That year she reached the semifinals before withdrawing against Simona Halep.
Rafael Nadal breezed past American Jared Donaldson 6-1, 6-1 and Roger Federer beat Peter Gojowczyk 6-1, 7-5 in the second round.
Akash Ambani and Shloka Mehta get married in a star-studded event
Taking the celebrations a notch higher tonight for the wedding reception, eminent personalities have already begun to pour in. Akash and Sholka's wedding will see ex-British Prime Minister Tony Blair and his wife Cherie Blair in attendance.
Halep, the No. 2 seed, needed almost two hours to beat qualifier Kateryna Kozlova 7-6 (3), 6-3 in the third round.
"I think I played well one set".
Marketa Vondrousova backed up her second-round upset of 2018 Indian Wells finalist Daria Kasatkina with another upset, of that of the 22nd seed Jelena Ostapenko.
Date, place, time: Here are details from Akash Ambani-Shloka Mehta wedding
After the guests relish some delicacies, they will witness the last stage of Akash Ambani and Shloka Mehta's wedding. The event saw performances by global artists Chris Martin of Coldplay and The Chainsmokers.
Along with Williams, the other seed to depart was Elise Mertens, the Belgian beaten by Wang Qiang 7-6 (7-4) 6-7 (4-7) 6-3 after a three-hour battle.