I do not believe jails rehabilitate criminals. Jails are what you find in communities for short term stays. They often offer the bare necessities and they don't provide housing to those who are given sentences, because those people serve their time in a prison. Jails and prisons are not the same.
I believe that more often than not, jails are a place which hardens criminals rather than rehabilitates them. The more harmless criminals, or even those that were wrongly accused and convicted are many times made worse out of a need to assimilate and to survive the hostile environment of prison.
Sadly, no, jails don't usually rehabilitate criminals - at least not in the U.S. The jails of Israel are great and do a fantastic job at rehabilitation, so do jails in some European nations, but U.S. jail system does the opposite. They a lot of times make criminals worse and have a high rate of repeat offenders.
I think jails do not rehabilitate criminals and it is not suppose to be looked as a rehabilitate tool anyway. Rehab should be done through counseling and programs after they have served their jail time. Jail is suppose to remind them of what they have done and this is the punishment they get for doing the crime.
I don't believe that prison rehabilitates criminals. I think the reoffending rate for most prisons is too high to believe in that. If prison has any effect, I think it is more the deterrence effect of being separated from family and home comforts, and the fact that while someone is in prison, they can't offend any further.