We now know that most stomach ulcers are caused by bacteria living in our stomachs called Helicobacter Pylori (H. Pylori). In 2005 two Australians, Barry Marshall and Robin Warren, were awarded the Nobel Prize for this discovery.
Somewhere about 40% of adults in the developed world have H. Pylori living in their stomachs and this figure is even higher in the developing world. Most of these people won't however develop stomach ulcers or show any symptoms of infection: only a minority of these people will develop stomach ulcers.