If you retire for health reasons, you still get the money. That's why Chris Davis is still being paid.
The last guy I can think of who retired for non-health reasons and the team didn't have to pay him was Adam LaRoche who walked away from tens of millions of guaranteed dollars in 2016 when the White Sox stopped allowing his teenage son into the clubhouse.