They're both crimes for which you could get transported to Australia for life, during its days as a penal colony. I learned this at Hyde Park Barracks, a museum dedicated to Sydney's penal days. Part of what makes the museum so striking (and so worthwhile if you're ever in Sydney) is its empathy for the convicts: its willingness to view them primarily as prisoners rather than solely as criminals.
These two categories, prisoner and criminal, might seem similar, but theologically they have very different resonances. The status of “criminal” does turn up fleetingly in the Gospels—in contexts which emphasize either God's forgiveness and the sinful complicity of the community, or the freedom of the criminal, his ability to accept God's grace and exemplify Christian witness.
Jesus' encounter with the woman caught in adultery has echoes of the Hebrew Bible's account of Susannah's accusation by the elders—a woman shamed by her community is vindicated by God—but we're explicitly told that Susannah was innocent, whereas the woman in the Gospels was caught red-handed. Whatever her reasons, whatever the pressures, fears, or desires which drove her to adultery, she really did do it, and that makes Jesus' turn from condemning her to asking the community to condemn itself all the more powerful.
It's important that the two thieves who were crucified with Christ actually did their crimes, and that these crimes are things which they themselves recognized as wrong; the story would look sharply different, and much less radical, if (for example) the thief who asked Jesus to remember him in His kingdom was actually an innocent wrongly convicted. This ability of the criminal to love God and surrender to Jesus is also the reason criminal status is important to, for example, Dostoyevsky's "Crime and Punishment," and in a more complex and conflicted way it drives Jean Genet's decadent, Catholic-inflected novels of criminality and baseness.
However, the social status of “prisoner” turns up far more often in Christian thought and history than the social status of “criminal.” Both are, of course, societal constructs; Hyde Park Barracks notes the ways in which financial troubles in England led to harsher criminal penalties. In our own country, increasing criminalization (where minor misbehavior now carries severe criminal penalties), mandatory minimum sentencing, and the War on Drugs have helped to drive massive increases in incarceration.
But in Christian thought the social status of “prisoner” takes on deep theological meaning, and this meaning exists separately from any facts about the prisoner's personal history. Whether she actually committed the crime for which she was imprisoned; whether that “crime” should ever have been illegal; whether her sentence was mild or outrageous; whether she ended up in prison because of her own selfishness and cruelty, because of mental illness, because of her bravery in the face of political tyranny, because of hopelessness, because of misplaced trust, because of her own sin or other people's—none of that is relevant to her theological status. What is relevant is her powerlessness.
And so prisoners turn up in the corporal works of mercy, one of which is “visiting prisoners,” and in the Gospel passage from which this command of charity is taken, Matthew 25:36. “I was in prison, and you visited me.”: God Himself is in prison, because He is in all forms of weakness and suffering, regardless of the personal history of the sufferers.
American culture often glorifies criminals, largely because criminals can attain and wield power. Henry Kissinger famously said that power is the ultimate aphrodisiac, and there's a familiar thrill for moviegoers in the cracking of the tommy gun, whether it's being wielded by Al Capone or Elliot Ness. Glorifying criminals is a normal impulse of fallen human nature. Empathizing with prisoners—honoring rather than despising them for their powerlessness—goes against our cruel instinct to separate ourselves from the humiliated.