It is not entirely clear how nonsteroidal anti-inflammatory drugs (NSAIDs) damage the stomach's lining, sometimes causing an ulcer. The following are the two likely ways this may happen:
It is also possible that both of these factors occur at the same time.
About 15 to 20 out of every 100 people who use high doses of NSAIDs, such as people who have rheumatoid arthritis or osteoarthritis, develop sores in the stomach that look like ulcers when examined with endoscopy.1 But only a small number actually develop symptoms or complications of peptic ulcer disease. Serious complications of peptic ulcer disease caused by NSAID use are higher in people who:1
You can prevent NSAID ulcers and their complications by not taking NSAIDs or by only taking them occasionally and in small doses. When NSAIDs must be used and you have a risk of complications, you can take misoprostol or proton pump inhibitors to reduce your chances of complications.
Citations
WebMD Medical Reference from Healthwise