"Justice" has several possible purposes, some only subtly different: Revenge, Restitution, Retribution, Rehabilitation, Incapacitation (or preventing a recurrence), Deterrence, Social Engineering.
1. Revenge may be intended to be cathartic, depending on the involvement of the victims, but a civilized society may make the process so relatively "humane" and long-drawn-out and expensive that a death penalty, for instance, most likely fails to provide satisfaction for society or for the victims.
2. Similarly, a lengthy incarceration might cost taxpayers a great deal, but prevent the evil-doer from earning the wherewithal to make financial restitution to his or her victims.
Solon of the ancient Greek world, suggested that persons who could not pay their debts could be sold into slavery, which might be a profitable form of incarceration with hard labor.
Some criminals would be too dangerous to be slaves, and there are reports that ancient Roman homes included safety measures to ensure that house slaves did not murder their masters in the night. Possibly, some of the most dangerous "debtors" could have been sold into gladiatorial schools, assuming that the barbaric public would pay to watch gladiators' entertaining deaths.
3. Rehabilitation, IMHO, is a bit of a non-starter in fiction. One has to have gross institutionalized unfairness, or an underdog anti-hero is not sympathetic; and if there is no fighting/conflict, it's hard to write a page-turner. Most science fiction convicts are unjustly accused good guys, such as Kirk, Starbuck, Buck Rogers, Spock etc. And, if one was not guilty in the first place, one cannot be rehabilitated.
4. Incapacitation (or preventing repeated crimes) is vividly demonstrated in One Flew Over A Cuckoo's Nest (not SF). Many SF examples of incapacitation are not successful by design, such as the Superman villains Zod, Non, and Ursa (??) who were entombed alive, to float in space forever... until they were rescued. A similar incapacitation method was tried in V, also with Merlin --trapped inside a tree--, also with the villain in EPIC who.... spoiler alert... was engulfed in a tree wart.
Historical and futuristic versions of incapacitation might be some of the more extreme versions of exile, to prison islands, prison planets, prison ships, prison spaceships as seen in The Chronicles of Riddick, in Star Trek, etc.
5. Deterrence (and Social Engineering) may not necessarily involve a convicted evil-doer at all, as in Hunger Games where a society is repressed and eternally punished for a rebellion, while also providing an elaborate, entertaining, and possibly profitable spectacle.
Horrific and barbaric public executions also serve to deter would-be troublemakers, but we don't see a lot of that in Romance or Science Fiction. It's the stuff of the Horror genre.
Random and spontaneous executions (Flash Gordon, Star Wars) probably are not as psychologically successful for deterrence, judging by the rebellions they inspire.
And then, there's LEXX.
Criminals and rebels had their useful organs harvested (by machines, without anaesthetic, on a conveyor system), and the rest of the bodies were processed as food for the LEXX. However, since the LEXX was a sentient dragonfly-machine that destroyed planets, it is not easy to categorize the thinking behind justice system. I was too revolted to watch enough of the series to understand whether the harvested organs were transplanted into good members of society.
Please enlighten me!
Science Fiction (and Science Fiction Romance) deals with advanced technology and issues of alternative or shifting morality. Did the civilized Star Trek society send Kirk to a prison planet so that he could fight to the death or be assassinated out of sight, because it would be uncivilized to kill him directly?
If technology means that we can print off new organs or body parts, or create a personalized chemical cocktail to replace blood, then we don't need to use criminals as perpetual blood donors, or one-time heart donors, and cannot use expediency as moral justification. What happens to the motivation of futuristic good vampires, if there is no reason for them to drink blood from a human?
Let me know what you think.
PS Some interesting resources: