It looked like the top seed would make quick work of Rogers in the rain-delayed encounter after romping through the first set in 26 minutes.
But world number 116 Rogers kept her composure and got the better of Williams as the first meeting between the two big-hitting Americans turned into a slugfest. Rogers sealed the win when Williams sent a backhand long on match point.
Serena suffers shock loss in 1,000th match, Osaka also out
- Liam Broady battles through, Harriet Dart the 'underdog' at UK Pro Classic
- Simona Halep finds groove to reach Prague semi-finals
Speaking after her victory, the 27-year-old said: "It's every kid's dream when they are growing up watching her play and to be able to do something like that."
Commenting on the absence of fans due to the Covid-19 pandemic, Rogers added: "Weird circumstances. Weird setting. But a win is a win. I know we're all just happy to be playing."
Rogers will face Switzerland's Jil Teichmann in the semi-finals at Lexington.
Williams was hoping the tournament would help her to get into top form for the US Open, which is due to start on August 31, despite the Covid-19 pandemic and will be the first Grand Slam since the Australian Open in January.
But having been stretched to three sets in all three of her matches this week, the 38-year-old may well have work to do if she is to launch a serious campaign for the elusive 24th Grand Slam title to equal Margaret Court's record.
"I could play a lot better, I think that's the main thing I can take from this match," Williams said.
"I made it difficult on myself by making a plethora of unforced errors."
In the other quarter-final of the day, 16-year-old Coco Gauff battled back to defeat Tunisian Ons Jabeur 4-6 6-4 6-1 and will next face fellow American Jennifer Brady.
Additional reporting by Reuters.
'Words cannot describe it' - Djokovic pays tribute to Serena on 1,000th match
Konta suffers swift defeat to Ostapenko at Italian Open