What's it called when someone who's been incarcerated for so long that when they're released they aren't able to function well because they're more comfortable in jail.
The term institutionalized is often used
(Of a person, especially a long-term patient or prisoner) made apathetic and dependent after a long period in an institution.
Oxford Dictionaries Online
Note that the term is used for people who have been in other types of institutions, such as mental hospitals.
In the movie Shawshank Redemption, Red tells Andy that Brooks has been in Shawshank for so long he was "institutionalized."
I have also heard "habituated" used to describe this condition, by a former inmate. He said that this was common usage among inmates, and that they would shorten it to " 'bitched " in informal settings. :-)
Some of these recidivists know they want to go back to jail; and some are subconsciously trying to get back to jail. On the other hand, some recidivists do not want to go back to jail -- but have bad habits, or are not willing to make all the sacrifices needed to follow the law.
"Institutionalized" is the word I think you're looking for. Urban Dictionary mentions it in connection to a soldier that's re-enlisted too many times. Unfortunately it seems there is a bit of a parallel between prison and the military.
Institutionalized is the right term, but I'd like to mention a related term:
Stockholm syndrome refers to positive feelings towards captors, but applies to those who are injustly held (hostages, POW's, concentration camp inmates.)