Cafergot is used to treat attacks of migraine with or without aura. These headaches are thought to be caused by temporary changes in the size of small blood vessels in the brain. These blood vessels swell, causing the pain and visual disturbances that often happen during an attack.