Do you have a link to the study? When I did a quick search I saw a pretty wide variety of numbers, not sure which one you are referring to.
Another way of writing that headline is potentially "cannabis users 24% more likely to admit to using cannabis when in a state where it's legal", or even "marijuana legalization brings cannabis users from out of state".
Even if the study you're referring to does effectively control for those two factors- I would hesitate to apply those results to a harder drug like heroine. Marijuana education and legalization are happening at the same time. The information on Marijuana is pretty promising and education may incentivize it's use for some purposes. I do not believe the same about heroine- education would probably disincentivize it's use.