She won the first three games of the match but called for the trainer after losing six straight to the Spaniard.
Her opponent, 25-year-old Muguruza, noticed that something was awry with Williams too.
Williams started the match well against Muguruza and lead 3-0.
"I don't really play that often, so when I do, I need to play well", she said.
Captain Marvel: Samuel L. Jackson on His MCU Advice for Brie Larson
It's not just her presence that might have surprised you but the fact that she was working the concessions stand. Captain Marvel is also the first Marvel superhero movie that's headlined exclusively by a female superhero.
Still seeking her first tournament title since returning in 2018 from a long layoff that included a hard childbirth, the 37-year-old Williams showed excellent form at the start of Sunday's match.
Tournament officials said the former world number one was suffering from a viral illness and Williams later confirmed she had been feeling ill ahead of the third-round tie.
She is now ranked 10th in the world.
It's the second time in four years that Williams has withdrawn from the tournament.
Prodigy frontman Keith Flint hanged himself at home, inquest hears
This is the first confirmation of Keith's cause of death since The Prodigy posted a tribute to the late star when the news broke. Prodigy frontman Keith Flint's cause of death has been officially revealed by a United Kingdom coroner's office.
"I had to adapt a little bit my position in the court, the way I was hitting, and it took me a few games to kind of do it", Muguruza said.
Halep's two holds - sandwiched around another break of Kozlova's serve - put the Romanian up 5-2 but she was broken serving for the match and needed one last break of Kozlova's serve in the final game to clinch it with a backhand up the line.
"It was hard for me to close out those sets", Halep told reporters, praising Kozlova.
Venus Williams is turning back her own clock at the BNP Paribas Open, moving into the fourth round with a 6-2, 7-5 victory over qualifier Christina McHale.
Pres. Trump budget calls for return to 'fiscal sanity'
One of them seems to be the electric vehicle tax credit which some politicians have criticized as a reward for the wealthy. Veterans' healthcare receives $80 billion, and $4.8 billion is allocated to fight America's ongoing opioid epidemic.
Halep next faces 61st-ranked Czech Marketa Vondrousova, who followed up her win over 2018 finalist Daria Kasatkina with a 4-6, 6-3, 6-4 win over 22nd seed Jelena Ostapenko of Latvia.