Esophagitis can cause pain while swallowing. Esophagitis can be caused by stomach acids backing up into the esophagus, infections, oral medications, and allergies.