When we are stressed, our bodies react, in part, through the release of a steroid called cortisol. It’s of course much more complicated than that, but the point is we respond. Such is the case for foreign invaders like viruses. Our immune system counters, in kind, by releasing specific types of cells to attack the infiltrating infection. And given that our genes are something like 50% similar to bananas, it should come as no surprise that plants respond to stress in similar fashion.
Cannabinoids provide natural sunscreen for cannabis plants. Small amounts of UV light have been reported to generate larger sums of delta-9-tetrahydrocannabinol (THC). Terpenes provide fragrant weaponry. Some plants release terpenes in response to being eaten.
Cannabis sativa is known to help scrub soils of heavy metal contamination. Hemp has been labeled as a hyperaccumulator , meaning it can grow in soils polluted with heavy metals, and can absorb larger volumes of heavy metals from tainted soil through its roots and into tissues like leaves. So, does C. sativa counter these foreign, elevated levels of heavy metals with a chemical response?
Hemp’s ability to phytoremediate soils surrounding an abandoned coal mine in Pennsylvania demonstrated that stressed hemp produced more cannabidiol (CBD).  The study considered five cultivars, the uptake of heavy metals such as arsenic, lead, nickel, mercury, and cadmium, and cannabinoid concentrations. Hemp plants were grown in two types of contaminated soil and two types of commercial soil (Miracle-Gro Potting Mix and PRO-MIX HP Mycorrhizae High Porosity Grower Mix). Trials for all soil types were conducted outdoors and in a greenhouse.
There was a notable difference in germination between seeds planted in commercial soils versus coal mine land soils. No differences were found between the commercial soils. Each type of soil was evaluated for heavy metals at the outset of the study. As expected, the heavy metal content of the mine land soils was higher than when Miracle-Gro Potting Mix was used.
A 2002 study demonstrated that heavy metal uptake occurred through hemp roots.  Lead, cadmium, and nickel predominantly settled in the leaves. The current study evaluated heavy metal uptake in one cultivar (Felina 32) after 60 days.  As with the earlier study, lead, cadmium, and nickel were detected in leaves from contaminated soil. Only lead (0.19 mg/kg) was detected in Miracle-Gro. Interestingly, a 2.5-fold increase in nickel was measured in leaves obtained from plants cultivated outside in the contaminated soil, juxtaposed to the same soil used in a greenhouse.
THC and CBD were quantified from plants (Fedora 17) grown in the field, in Miracle-Gro, and in the mine soil. Higher THC levels were measured in plants grown in Miracle-Gro versus the contaminated soil. Higher CBD levels, however, were found in the mine soil. Interestingly, both cannabinoids were elevated in plants grown in the greenhouse compared to outdoors, regardless of soil.
The researchers evaluated the genetic expressions of the hemp grown in Miracle-Gro compared to mine land soil. The enzyme that converts cannabigerolic acid (CBGA) to cannabidiolic acid (CBDA), called CBDA synthase, was expressed at 18-fold higher levels in plants grown in contaminated soil. Olivetol acid cyclase (OAC), an enzyme involved in olivetolic acid synthesis, kickstarting cannabinoid biosynthesis, was also detected at higher levels in the heavy metal soil. 
So, when stressed from heavy metal uptake, the hemp plants manufactured more CBD.
- Linger P. et al. “Industrial Hemp (Cannabis sativa L.) Growing on Heavy Metal Contaminated Soil: Fibre Quality and Phytoremediation Potential.” Industrial Crops and Products, vol. 16 no. 1, 2002, p. 33–42. [journal impact factor = 4.191; timed cited 136 (ResearchGate)]
- Husain R. et al. “Enhanced Tolerance of Industrial Hemp (Cannabis sativa L.) Plants on Abandoned Mine Land Soil Leads to Overexpression of Cannabinoids.” PLoS ONE, vol. 14, no. 8, 2019, e0221570. [journal impact factor = 2.776; timed cited 0]