An employer can fire you if they don't like the fact that you were hammered on Friday. They can fire you if they don't like the color shirt you are wearing. Just because you are doing something legal doesn't mean you can't get fired for it.
You are only protected if you are in a protected class (race, sex, disability, etc) and you are fired (or another negative) for that reason. Your friend may be protected by the ADA which is why he may need the medication.
A couple of states (I believe 2 or 3 at most) have stated that you cannot be fired for legally taking medical marijuana (so long as no effect at work) but the vast majority and I believe Colorado, Oregon and D.C. are all on this list, say that just because you cannot be arrested for using marijuana does not mean that an employer cannot fire you for that reason.
You may not like it but that is the law. Could that change in the future? Sure but as of right now that is the law in almost all states.