I think the proper way to approach this question is to turn it around to the contrapositive. Think for a moment about the worst, most despicable, evilest, and most unworthy person imaginable: a serial killer, a genocidal dictator, an ideological tyrant, or whatever bogieman you happen to favor. What can we do to such a person that we could not do to someone worthy? Set aside imprisoning them, which is a practical matter more than a moral issue, and ask yourself:
- Can we beat or torture this person, as payback?
- Can we mutilate or disfigure him, for a pragmatic purpose or out of pure vindictiveness?
- Can we strip him naked and tie him up for people to gawk at, like a wild animal in a cage?
- Can we force him into slavery (even sex slavery) to debase and disgrace him?
In other words, is this person completely exempt from the consideration and restraint we show 'humans', so that he is an open target for whatever petty, vindictive, vicious, vengeful thought might occur to us?
Moral philosophy generally argues against this kind of treatment, even for the worst of the worst. On one hand there's a deontological issue that no one would ever accept this as a universal rule: in other words, no individual would agree that s'he should be subjected to this kind of treatment if s'he were judged to be among the worst of the worst, and thus cannot reasonably suggest that other people should be subject to it. On the other hand, there's the semi-consequentialist argument that indulging in these brutal acts against a horrible person reduces us to the moral level of that horrible person, bringing into question our right to render any judgement against him at all.
The point here is that even those people we rightly and justifiably despise are due a certain amount of consideration and circumspection, if only to preserve our own moral consistency, integrity, and security. We do not want to be sociopathic; we do not want our society to be sociopathic in our stead. We want to be better than the sociopaths we condemn for their horrible behavior, we want our society to rise above them, and so we must place limits on our behavior when we deal with them.
This 'placing limits on our behavior' is tantamount to respecting certain basic rights and dignities of these horrible individuals. And if we do it for them, why shouldn't we do it for everyone?
The problem we face in a lot of social settings is that concepts like 'evil' and 'despicable' are inherently subjective. While we can all generally agree that someone who (say) runs around killing people for the sheer fun of it is despicable, and subject to some form of punishment, there are plenty of people in the world who think that others are 'evil' or 'despicable' merely because they have a different skin color, a different ethnicity, a different sexual preference, a different religion, etc. Half of the world's population is treated quite poorly because they happen to have been born with two X chromosomes, not one, and where's the logic in that? And so we have pogroms, genocides, terror campaigns, suppression and oppression: all of the horrors that occur when one group decides that another is despicable and completely unworthy of respect as humans.
This is what the political concept of 'human dignity' is aiming at: that there is a baseline of behavior that we cannot sink below without bringing our own humanity and moral nature into question. Even when dealing with criminals, we want our system of restraint and punishment to be 'humane' so that it has a positive effect on both the criminal and the society. A system that is 'inhumane' (which, incidentally, literally translates as 'not human') degrades the prisoner and the society and ourselves. And how much more true is this for people who are merely different from us?