Williams and Muguruza were facing off for the sixth time, with the Spaniard winning the last meeting in the final of the 2016 French Open
Serena Williams retired from her third-round match at Indian Wells while trailing Garbine Muguruza 6-3 1-0.
She won the first three games of the match but called for the trainer after losing six straight to the Spaniard.
The American took to the court for the second set, but retired after world number 20 Muguruza held in the opening game.
Williams was seeded 10th in her first tournament since a quarter-final exit at the Australian Open.
"We've played many times and it's always super-tough, super-exciting," said Muguruza, like Williams a former world number one.
"I wish I'm going to see her soon and [she's] feeling better."
Muguruza next faces seventh seed Kiki Bertens, who beat Britain's Johanna Konta.