It's both, isn't it? If it was about rehabilitation, then the prison sentence would be based on the necessary amount of rehabilitation and likelihood of reoffending rather than the severity of the crime. When you're talking about people who commit serious crimes where they're being sentenced to several decades in prison, that's not about rehabilitation, it's about punishment. And if you're looking at a prison sentence in terms of punishment, then a 50 year sentence means something very different to somebody with 60 years left to live than it does to all these isekai'd Japanese people who don't have a fixed lifespan because their RPG cheats cause them to not age.
Look at it this way: is it really fair that a native worlder and an isekai'd person (or an elf, in your example), who committed the same crime, should get a punishment where one of them will come out of prison eldery and close to death, and the other person will come out of prison in exactly the same health and state that they went in? Is that really fair? Does that sentence, despite being an equal amount of time, really represent an equal punishment?
The native worlder might see a 50 year sentence as spending nearly all their remaining days in prison, while the person who doesn't age might see it as a really annoying inconvenience that has no long-term impact if they just wait it out.