To treat stomach and intestinal ulcers and prevent them from returning after healing. This medication is also used to treat certain stomach and throat (esophagitis) problems (such as erosive esophagitis