The expectation was that the pair would meet in the quarter-finals on Tuesday but, while Williams eased to a 6-2 6-2 victory over Carla Suarez Navarro, Barty was beaten 3-6 6-2 6-3 by unseeded American Alison Riske.
Barty had won 15 matches in a row dating back to the Italian Open in May and taking in her maiden grand slam singles title at the French Open and success on grass at the Nature Valley Classic in Birmingham that elevated her to the top of the rankings.
But she found grass-court specialist Riske too big an obstacle, the 55th ranked American recovering from a set down to reach her first slam quarter-final.
"I'm so incredibly excited," said Riske. "The fact that it's at Wimbledon, my favourite grand slam, the place that I had always dreamed to be in the last eight club of – they can't kick me out now, I'm here to stay. I am just over the moon."
Barty began the match with a whole game of aces but was let down by her serve as the contest worse on.
She focused on the bigger picture, saying: "It's disappointing right now. Give me an hour or so, we'll be all good. The sun's still going to come up tomorrow. It's been an incredible few months. I'm very proud of what we've been able to achieve."
Williams had barely played since the Australian Open because of a knee problem but she is increasingly looking like a clear title favourite.
The 37-year-old said: "The rust is definitely wearing off. Most of all I feel confident that I can actually move and I don't have to go for winners so soon because I'm in pain."
Simona Halep ended the phenomenal run of 15-year-old Cori Gauff with a 6-3 6-3 victory on Court One.
Gauff will now focus on finishing high school, and she said: "These past two weeks have been amazing. I'm excited to be back next year."
Seventh seed Halep is the highest-ranked player left in the women's tournament after Karolina Pliskova and Petra Kvitova joined Barty in tumbling out.
Barty's defeat meant Pliskova could have overtaken her as world number one by reaching the final but instead the third seed was beaten 4-6 7-5 13-11 by fellow Czech Karolina Muchova.
The match had looked poised to be the first to be decided by the newly-introduced tie-break for matches that reach 12-12 in the final set only for 22-year-old Muchova, who is making her Wimbledon debut, to win it on a net cord.
Sixth seed Kvitova had been a major doubt for the tournament because of a forearm injury but had won her first three matches in straight sets.
She won the opener against home favourite Johanna Konta but the British player hit back to win 4-6 6-2 6-4 and will play another Czech, Barbora Strycova, in the last eight.
Halep will face China's Zhang Shuai, who had lost in the first round on her five previous appearances at Wimbledon but is now through to her second slam singles quarter-finals after beating Dayana Yastremska 6-4 1-6 6-2.
Strycova staged a tremendous recovery from a set and 5-2 down to beat Elise Mertens while Muchova will face eighth seed Elina Svitolina, who is having her best run at Wimbledon and defeated Petra Martic 6-4 6-2.