Opioid receptors are widely distributed in the human body and are crucially involved in numerous physiological processes. These include pain signaling in the central and the peripheral nervous system, reproduction, growth, respiration, and immunological response. Opioid receptors additionally play a major role in the gastrointestinal (GI) tract in physiological and pathophysiological conditions. This review discusses the physiology and pharmacology of the opioid system in the GI tract. We additionally focus on GI disorders and malfunctions, where pathophysiology involves the endogenous opioid system, such as opioid-induced bowel dysfunction, opioid-induced constipation or abdominal pain. Based on recent reports in the field of pharmacology and medicinal chemistry, we will also discuss the opportunities of targeting the opioid system, suggesting future treatment options for functional disorders and inflammatory states of the GI tract.