This is an inconsistent statement. In once sentence you say that free mental healthcare doesn't work, then in the next you posit that imprisoning them, then providing free mental healthcare is the answer. I think at the end of the day, people need to want to stop using drugs and have the help they need to do so. I don't think prison is the magic bullet for bringing about that change that you imagine it to be.
> People on meth run around the streets at night causing chaos. Homeless people on heroin leave needles everywhere. People avoid transit and parks now because there is regularly someone losing his or her mind nearby.
It's not realistic to expect only legalizing drugs to solve all your social problems. Why are there homeless people? Why are people having mental health crises on the street, and the only options are to ignore them, or put them in prison? I'm not sure what is meant by "causing chaos", but if they are committing non-drug crimes, why are they not being arrested?