IDK I have a partner in prison and I don't think going to jail is a real disincentive to taking heroin. There are a lot of drug addicts in prison who start using as soon as they get out of prison. Arresting addicts often makes them less likely to be able to get a job once they get out too, so they go back to the streets. It's a revolving door.
I don't see anything that the prison system does that is designed to actually make a drug addict a healthy member of society. It's just punishing people who already use drugs to get away from negative feelings. So causing them even more negative feelings? Is going to make them want to "escape" even more.
People seeing an open air market of heroin where people OD and seem to be in a miserable zombie state, if they see that and think "omg heroin is a great idea" then you should think about why they would think that because a normal healthy person wouldn't see a heroin addict shitting on the street and think "omg goals". A normal person would look at these people and think "what broken shells of humanity, I will never touch heroin ever". The only people who would see heroin addicts everywhere and think "it's OK to do heroin now" are people who are already addicted to opiates and can't afford oxy anymore.
People should want to not do heroin because heroin addiction ruins your life and destroys your dignity. Not because it's morally wrong to take drugs, or because the cops will punish them for it. Heroin addiction is a stronger disincentive for someone to start taking heroin than going to jail is. So if the prospect of ruining your life isn't enough to make you stop, then jail won't either.