In the medical field, barium sulfate is primarily used as a contrast medium for X-ray imaging of the gastrointestinal tract. When ingested or administered as an enema, it enhances the visibility of the digestive system on radiographic images. This is crucial for diagnosing conditions such as blockages, tumors, or abnormalities in the esophagus, stomach, and intestines.