Kerber led 6-4, 4-6, 2-1 when the fifth-seeded Keys retired.
''It was a really good match in the first two sets, and this is never the way that you want to win,'' Kerber said. ''I hope Madison will recover really soon so she is ready for the next tournaments.''
Keys recorded 39 winners against 33 unforced errors while Kerber had 18 winners and 13 unforced errors.
Linette next faces second-seeded Ekaterina Alexandrova for the first time. The Russian beat Kristie Ahn of the United States 6-7 (0), 6-4, 6-4. Ahn held a 2-0 lead in the decider before losing four straight games and was unable to make a comeback.
In the other quarterfinals, Karolina Muchova beat Priscilla Hon 6-3, 6-3 to set up a match against eighth-seeded Yafan Wang, who beat Paula Badosa 6-1, 6-3.
At the Guangzhou International in China, Samantha Stosur rallied after a slow start to beat Viktorija Golubic 2-6, 7-6 (4), 6-1 in the semifinals and qualified for her first WTA singles final in 2 1/2 years.
''I just tried to hang in there and find a way to start playing a bit better,'' Stosur said. ''She's very tough to play against so I'm just happy to get through.''
Stosur is chasing her first title since winning at Strasbourg in 2017. Her opponent will be third-seeded Sofia Kenin after the American defeated Anna Blinkova of Russia 7-6 (2), 4-6, 6-1.
More AP Tennis: https://www.apnews.com/apf-Tennis and https://twitter.com/AP-Sports