Opioids, such as morphine and heroin, cause miosis by stimulating the parasympathetic nervous system. These drugs bind to opioid receptors in the brain, leading to increased activity in the Edinger-Westphal nucleus, which then triggers the constriction of the pupil. Miosis is a classic sign of opioid overdose or poisoning.