Cannabis has been used for both medical and spiritual applications for a considerably long time; one of the first was in the Atharva Veda, written around 1400 BCE. It isn't hard to imagine it'll still exist in the 25th century and beyond.
It's so ridiculous that in an episode where there's use of alcohol as a mind-altering substance, there's objection to marijuana still being in use in the future. Why is what was legal in the late 20th century United States the only stuff that would still be in use 500 years later?