The seventh seed was due to face Gael Monfils, but the Frenchman withdrew due to an Achilles injury.
Dominic Thiem advanced to the ATP Indian Wells Masters semi-finals after France's Monfils pulled out with a left Achilles tendon injury.
Kecmanovic, who gained entry to the draw after 5th-seeded Kevin Anderson withdrew was the first lucky loser to reach the quarter-finals at Indian Wells since the tournament served as the inaugural ATP Masters 1000 event in 1990.
Belinda Bencic caused another upset at the BNP Paribas Open by beating world number five Karolina Pliskova to reach the semi-finals in Indian Wells.
"Venus is just such a great player and an unbelievable champion", Kerber said about her opponent, who came on to the court with a heavily taped right knee.
Raonic won 88 per cent of his first-serve points and saved all three break chances against him.
From 4-2 down, the World No.8 ran off the last four games of a high-quality opener which saw almost 20 winners combined between the two players, and Kerber broke the No.23 seed for the third time from 30-0 down in the set's last game.
"I was really surprised", Thiem said, who was waiting to be taken to the court when he realized there was a problem". Until Kerber stopped her, Williams had won four matches in a row for the first time since a year ago in the desert. He put only 55 percent of his first serves in play. She won her third career title at Dubai last month and her first since 2015. From the get-go, Kerber made strong in-roads into Williams' serve, especially the second serve and was just as relentless on her own serves.
Kerber has won the last three meetings against Bencic, and all six matches overall have been decided in six straight sets.
Bencic showed no sign of a let-down after her fourth-round victory over world number one and defending champion Naomi Osaka, out-lasted Czech Pliskova 6-3, 4-6, 6-3.
The Swiss racked up 27 unforced errors in the match to just 14 winners, and Kerber converted seven of the nine break points she held, thanks in part to winning 65 percent of points played in Bencic's service games overall. She'll face No. 6 seed Elina Svitolina of Ukraine on Friday.