If you have a stomach ulcer, your treatment will depend on what caused it. With treatment, most ulcers heal in a month or two. If your stomach ulcer is caused by a Helicobacter pylori (H. pylori) bacterial infection, a course of antibiotics and a medication called a proton pump inhibitor (PPI) is recommended.