Yes, medical marijuana is legal in Virginia.
There are three medical exceptions to the statutes that criminalize the possession of marijuana. The statutes that make exceptions for medical marijuana appear broad, but actually Virginia courts have limited them significantly.
1. Cannabidiol Oil
The first medical marijuana statute that legalizes medical marijuana involves cannabidiol oil or THC-A oil. The statute is Va. Code § 18.2-250.1(C) and it says
C. In any prosecution under this section involving marijuana in the form of cannabidiol oil or THC-A oil as those terms are defined in § 54.1-3408.3, it shall be an affirmative defense that the individual possessed such oil pursuant to a valid written certification issued by a practitioner in the course of his professional practice pursuant to § 54.1-3408.3 for treatment or to alleviate the symptoms of (i) the individual's intractable epilepsy or (ii) if such individual is the parent or legal guardian of a minor, such minor's intractable epilepsy. If the individual files the valid written certification with the court at least 10 days prior to trial and causes a copy of such written certification to be delivered to the attorney for the Commonwealth, such written certification shall be prima facie evidence that such oil was possessed pursuant to a valid written certification.
2. Cancer and Glaucoma Treatment
The second statute that legalizes medical marijuana involves marijuana possessed pursuant to a valid prescription issued by a doctor for the treatment of cancer or glaucoma. The statute is Va. Code § 18.2-251.1(A) and it says
A. No person shall be prosecuted under § 18.2-250 or § 18.2-250.1 for the possession of marijuana or tetrahydrocannabinol when that possession occurs pursuant to a valid prescription issued by a medical doctor in the course of his professional practice for treatment of cancer or glaucoma.
3. Valid Prescription
The third statute that legalizes medical marijuana involves marijuana possessed pursuant to a valid prescription. The statute is Va. Code § 18.2-250.1(A) and it says
A. It is unlawful for any person knowingly or intentionally to possess marijuana unless the substance was obtained directly from, or pursuant to, a valid prescription or order of a practitioner while acting in the course of his professional practice, or except as otherwise authorized by the Drug Control Act (§ 54.1-3400 et seq.).
That's where the good news ends, however.
The Bad News
Even though the above quoted statutes appear broad, they really aren't. The third statute, Va. Code § 18.2-250.1(A), is especially broad because it appears to allow anyone to possess marijuana so long as they have a valid prescription. However, the Virginia Court of Appeals has basically robbed 18.2-250.1(A) of any meaning. The court did that in Murphy v. Commonwealth. In Murphy the court held that because 18.2-251.1 allows Virginians to possess marijuana pursuant to a valid prescription, but only to treat cancer or glaucoma, that means that the much broader language of 18.2-250.1(A) is also limited to prescriptions for cancer or glaucoma.
Medical marijuana is legal in Virginia, but really only pursuant to a valid prescription and only if the prescription is issued to treat cancer, glaucoma, or epilepsy. If you have a prescription to take marijuana for pain relief or to relieve anxiety, you are still committing a crime in Virginia.