I believe the purpose of prison in a civilised society, is firstly, to protect the public from dangerous criminals;
Secondly, for the criminal to pay for their crime by serving an appropriate sentence;
And finally, if possible, to rehabilitate the criminal.
Vengeance is not justice imo, and not the function or purpose of the law.
If a drying convict is felt to meet the first of these criteria - ie he (it’s usually a he) is no longer a threat to society at large, release should be considered, but the other two criteria might also be factors in the decision. Rehabilitation though, might not be so important with a dying man.