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.

The single-lane bridge over the Cuckmere river on the A259 between Eastbourne and Seaford regularly has long queues of traffic on both sides.
Many visitors to Seven Sisters Country Park, Beach Head and Birling Gap on the East Sussex coast use the route.
A government grant is to be used to build a new two-lane crossing.
East Sussex County Council said it would chose a location for the bridge which minimises the impact on South Downs National Park.
Traffic can only cross the existing bridge in one direction at a time. Priority is given to vehicles travelling from the west, causing long delays for those waiting to cross from the Beach Head and Birling Gap side.
Councillor Rupert Simmons, lead member for economy, said: "As well as being frustrating for motorists, the bottleneck does nothing to help the businesses in our county.
"We have considered a number of options to deal with the problems at Exceat, including traffic lights, but it is felt that a new two-lane bridge is the only way to effectively deal with the congestion created by the current layout.
"The location of the new bridge is a sensitive one and will need to be carefully designed to minimise the impact it has on the South Downs National Park in which it sits."
Any proposals will be subject to discussion and approval from the South Downs National Park Authority (SDNPA), the council said.
A spokesperson for the South Downs National Park Authority said: "As the planning authority for the South Downs National Park, we would welcome pre-application discussions with East Sussex County Council as they develop their plans.
"Any application that comes forward will need to be of a high quality, taking into account both this sensitive location; the people who know and use this area, and the special qualities for which the national park was designated."

Some of the lighter moments from the campaign trail as parties start to launch their election manifestos.
World number one and defending champion Serena Williams suffered a shock defeat in the fourth round of the Miami Open.
[NEXT_CONCEPT]
A bottleneck on a popular tourist route along the south coast is to be tackled with a new £2m bridge.
[NEXT_CONCEPT]
All photographs subject to copyright