Rybakina, the third seed, was 1-3 down and visibly struggling in the first set before pulling up at 15-all on her serve.
The 2022 Wimbledon champion also withdrew from Rome last month citing illness before the quarter-finals, just before the French Open.
The 25-year-old Russian-born Kazakh was stunned by Italian Jasmine Paolini in the quarter-finals of Roland Garros.
She will bid to recover for Wimbledon starting on July 1st where she lost in the quarter-finals last year to Tunisian Ons Jabeur.
Former number one Azarenka, 34, will play either compatriot Aryna Sabalenka, the second seed, or Russian Anna Kalinskaya in Saturday's semi-final.
Reigning Wimbledon champion Marketa Vondrousova retired injured from her second-round match in the Berlin grass-court event on Thursday against Kalinskaya.