It's a question you've probably seen before, and the answers are usually a pretty mixed bag, kind of half-and-half.
Let's say you are in your late teens, 20s, or 30s, and are very poor. In this situation, many people may end up either homeless or jailed. Which would you rather prefer?
However it greatly depends on where you are (climate, etc), and how long you're homeless or in jail. If you're homeless and living in Detroit or Minneapolis it would probably be horrible due to the bitter cold winters. It probably may be easier if you're in CA, Florida, Texas, Hawaii , etc.
Both are shitty situations, but at least you are provided shelter and fed in jail, even though I've heard the food sucks. I've never been in jail or homeless (except for one day kind of), but I'd have to say I'd probably rather do time in the county jail if it were for a few months or up to a year. If it were long term, I'd have to question it. I really wouldn't want to spend a lot of time in prison, and if I tried to find a job in the future, having a serious criminal record would hurt me.