The actions of cannabis are mediated by receptors that are part of an endogenous cannabinoid system. The endocannabinoid system (ECS) consists of the naturally occurring ligands N-arachidonoylethanolamine (anandamide) and 2-arachidonoylglycerol (2-AG), their biosynthetic and degradative enzymes, and the cannabinoid receptors CB1 and CB2. The ECS is a widely distributed transmitter system that controls gut functions peripherally and centrally. It is an important physiologic regulator of gastrointestinal motility. Polymorphisms in the gene encoding CB1 (CNR1) have been associated with some forms of irritable bowel syndrome. The ECS is involved in the control of nausea and vomiting and visceral sensation. The homeostatic role of the ECS also extends to the control of intestinal inflammation. We review the mechanisms by which the ECS links stress and visceral pain. CB1 in sensory ganglia controls visceral sensation, and transcription of CNR1 is modified through epigenetic processes under conditions of chronic stress. These processes might link stress with abdominal pain. The ECS is also involved centrally in the manifestation of stress, and endocannabinoid signaling reduces the activity of hypothalamic–pituitary–adrenal pathways via actions in specific brain regions—notably the prefrontal cortex, amygdala, and hypothalamus. Agents that modulate the ECS are in early stages of development for treatment of gastrointestinal diseases. Increasing our understanding of the ECS will greatly advance our knowledge of interactions between the brain and gut and could lead to new treatments for gastrointestinal disorders.