Rarely, surgery is needed to help ulcers heal. You may need surgery if your ulcers keep coming back or causing complications, such as blocking food from moving out of the stomach.