Actually, no, the reason why you can't buy opiates without a prescription is because they are addictive psychoactives.
Like I said, dangerous overdoses and side effects are one reason, not the only reason.
Which drugs are legal, and which don't require prescriptions, is in large part a matter of historical contingency, lobbying and politics. But there are other reasons too, and dangerous side effects or overdose effects are among the more important ones.
Over at Scott Adams' Blog you can find a very fine example of using the 'Rationality Engine' to solve the social problem of assisted dying.