Fellow former world number one Williams and top seed Osaka also advanced in straight sets against Christina McHale and Danielle Collins respectively.
World number one Osaka never found her rhythm against Belinda Bencic as the Swiss used her precise groundstrokes and pinpoint serving to topple the defending champion 6-3 6-1 in just over an hour.
Bencic improved to 5-0 in matches against the Top 10 this season, having beaten four Top 10 players to win the crown at the Dubai Duty Free Tennis Championships, and extended her season-long winning streak to 11 matches. "Honestly, at a time like this with that scoreline, I would usually feel very depressed and sad".More news: Mozambique braces for 'extremely dangerous' Cyclone Idai
Williams, who made the semifinals in the desert previous year, was playing McHale for the first time.
The women's field lost its top two seeds as Romania's Halep, the 2015 Indian Wells victor, fell to Czech teenager Marketa Vondrousova 6-2, 3-6, 6-2. I'm really happy with myself.
The world No. 23 player will next battle against fifth seed player Karolina Pliskova for her place in the semi-finals.
Halep responded after losing the opening set, dropping just three service points to level the match in fine fashion. Halep got injured during the match and received treatment for blisters on her foot.More news: Disney reinstates James Gunn on Marvel's Guardians of the Galaxy Vol. 3
She added that despite failing in the first title defence of her career, she thought she had handled the challenges well, saying: "I didn't lose in the first round". Vondrousova, who beat 2018 runner-up Daria Kasatkina and former French Open victor Jelena Ostapenko on the way to the fourth round, will go for another big win when she faces sixth-seeded Elina Svitolina, who battled to a 7-6 (10/8), 5-7, 6-4 victory over Australian Ashleigh Barty.
"I feel like there is no anonymity", she said.
"She was playing really fast and flat, so that was something I was not really expecting", the German said of her opponent.
In other third-round action, three-time grand slam champion Angelique Kerber came from a set down to beat Russian qualifier Natalia Vikhlyantseva 3-6, 6-1, 6-3.More news: Murray shows off arm at Pro Day
Williams converted seven of nine break points and hit 20 winners as she earned a meeting with Mona Barthel, who stunned 15th seed Julia Goerges 7-5 1-6 6-4.