What does a 20 year old alcoholic do? What does a 20 year old gambling addict do? It's wild that people even think of prison as an acceptable answer when there are so many analogs of things that people can abuse or get addicted to, things which we don't criminalize
One point people don't tend to know, is that a lot of folks actually get drugs in jail, and often prefer them. There's quite a few opioid replacements that get offered to anyone who can show addiction withdrawl, and many folks say they're actually a better, longer high than the street stuff.
There's also some revolving door, and 'Shawshank' style issues, where folks rotate out for a couple months in the spring / summer, do whatever on the street, and then rotate back in the fall / winter with some dumb crime. Eat, rest, stay warm, get the opioid replacements, then head back out. Kind of a homeless shelter where you just have to do some 3-month misdemeanor stint to get room / board.
Although long incarceration can definitely be an issue, there are also some folks who've made it a lifestyle.