It's fairly common, and unremarkable, for people to get fired for being drunk on the job, despite alcohol's legality. I expect it's also fairly common and unremarkable for people to get fired for being stoned on the job, and that won't change when pot becomes legal; as you say, it's a safety issue.