If you live in a state that has legalized the medical use of marijuana, there is no requirement under any of the state laws that you be a U.S. citizen to use medical marijuana. Some states require you to register in order to take advantage of the law, and require a state-issued identification card to prove you live there.
If you are not in the country legally, you may have difficulty obtaining such identification. If you are a lawful permanent resident of the U.S. (a “green card” holder) and you don’t yet have identification like a driver’s license or state ID card, however, you can apply for one by showing your green card.
Just because your state allows you to use medical marijuana does not mean there is no risk to your lawful permanent resident status by doing so. This is because your immigration status is a federal matter, governed by federal law that makes any marijuana use illegal. So, even though your state may not convict you for using marijuana for medical purposes, the federal government can. What's more, the Trump Administration has expressed its intention to crack down on marijuana use even in state where it's legal.
Green card holders convicted of a violation of a federal law relating to marijuana (other than a single offense involving possession for their own use of 30 grams or less) are deportable. You’re also deportable if you are a “drug abuser or addict.” It’s possible that the U.S. government will allege that your medical use of marijuana constitutes abuse or addiction.
Also, conviction of certain crimes involving “moral turpitude” can get you deported. That’s a fuzzy term under the law, and you can’t be sure what a court will say. However, possession of marijuana for personal use is likely not a crime involving moral turpitude. Growing marijuana for a medical purpose likely wouldn’t be either. For more on crimes of moral turpitude, see What’s a Crime of Moral Turpitude According to U.S. Immigration Law?
If you’re a green card holder who wants to travel outside the U.S., your medical use of marijuana could cause you problems getting back in and staying in the United States. This is because the U.S. Customs and Border Protection officer at the border could treat you as an “arriving alien” who must be “admissible” to the United States.
As a green card holder, you’re not always an “arriving alien” when you come back after travel, but you are an inadmissible arriving alien if have been convicted of a federal crime relating to marijuana — or even if you admit having used marijuana, no matter how legal it was in your state. (Carrying a medical marijuana card in your wallet is a sure tipoff.)
You also have to be concerned with anything you’ve done that would give the government reason to believe you’re a marijuana “trafficker,” or dealer. This might include admitting that you work for a legal dispensary or grower.
If you are determined to be an inadmissible arriving alien, you will most likely be let back into the country temporarily, and deportation (removal) proceedings will be started against you. You might be eligible for a “waiver” of your inadmissibility if your crime is a single offense of simple possession of 30 grams or less of marijuana.