Abso-f@#$ing-lutely.
If there's zero probability that someone's going to commit a crime again, then any sentence that they receive is purely punitive, and it's there for only two reasons, 1) to satisfy our emotional need to punish someone that did something wrong, and 2) to signal to other potential offenders that if they do the same thing, they won't get away with it.
But if someone is very likely to commit more crimes, locking them up adds 3) they will not be able to commit these crimes while they're incarcerated.
The relative values of 1), 2), and 3) shift sharply depending on the seriousness of the crime and the likelihood of future crimes, and the value that we as a society gain (or lose) by locking someone up depends critically on how they add up.
If two men commit exactly the same murder (physically speaking), but one of them does it because he caught his wife in bed with another man and the other does it because she didn't cook the steak rare enough that night, I would be perfectly fine with the first man getting a lighter sentence: it took a very extreme situation for him to resort to murder (though it's still not justified by any means, don't get me wrong, and he should still be punished based on 1) and 2)), whereas the second guy is pretty clearly a loose cannon, and is likely to pose a far greater threat to everyone if he's allowed back on the streets.