The 21-time Grand Slam singles champion lost 6-7 (3-7) 6-1 6-2 to Russian 15th seed Svetlana Kuznetsova.
It was the 34-year-old American's joint earliest exit from the tournament, which she has won eight times.
"The players come out and play me like they've never played before in their lives," said Williams, who had not lost in Miami since 2012.
She has now not won a tournament since August, when she claimed the 69th title of her career, in Cincinnati.
"I don't think it's appropriate to criticise my movement right now," she added, in response to questions from reporters. "I did the best that I could. I can't win every match."
Kuznetsova said she was "really thrilled" but apologised to fans who hoped to see more of Williams at this tournament.
She added: "I tried to stay at a good level the whole game. I think I did that pretty well and I'm happy with the way I served."
Poland's third seed Agnieszka Radwanska also lost, beaten 2-6 6-4 6-2 by 19th seed Timea Bacsinszky of Switzerland.
Also on Monday, British number one Johanna Konta beat 32nd seed Monica Niculescu 6-2 6-2 to reach the quarter-finals, while Heather Watson was defeated 6-3 6-4 by Romania's Simona Halep.
World number one and defending champion Serena Williams suffered a shock defeat in the fourth round of the Miami Open.