Endorphin production is connected to exercise. Endorphins are chemicals that are able to cross through the gaps between neurons in order to pass along a message from one to the next. There are many different kinds, and much remains to be learned about their different purposes and functions.
When endorphins lock into special receptor cells (called opioid receptors), they block the transmission of pain signals and also produce a euphoric feeling -- exactly like opiates.
Endorphins act as both a painkiller and as the pay-off for your body's reward system. A strenuous yoga session allows your body to tap into its own stash of "opiates".
A study published in July 2012 found that, among 86 patients who took on a yoga-based lifestyle to prevent and manage diseases, a majority of participants showed lower levels of cortisol (a hormone that increases due to stress) and higher levels of endorphins.
References:
1. Thorén, Peter, et al. "Endorphins and exercise: physiological mechanisms and clinical implications." Medicine & Science in Sports & Exercise (1990).
2. Farrell, PETER A. "Exercise and endorphins--male responses." Medicine and science in sports and exercise 17.1 (1985): 89-93.
3. Harber, Victoria J., and John R. Sutton. "Endorphins and exercise." Sports Medicine 1.2 (1984): 154-171.
4. Büssing A, Michalsen A, Khalsa SB, Telles S, and Sherman KJ. Effects of Yoga on Mental and Physical Health: A Short Summary of Reviews. Evid Based Complement Alternat Med. 2012; 2012: 165410 https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3447533/