Some mouth ulcers are caused by physical damage - from the sharp edges of broken fillings etc. The majority, however - collectively known as Recurrent aphthous stomatitis (RAS) have no obvious cause - and so are classed as 'atopic'. Estimates vary widely as to the percentage of the population affected. Somewhere between 5% and 60%.
The causes of RAS are as yet unknown. It's currently thought to be likely to be due to a combination of factors rather than one single cause. Bacterial and viral infections are considered unlikely. It's also been suggested that RAS may not be a single entity but rather a group of conditions with different causes.
Patients who have suffered from recurrent episodes over several years often spontaneously recover, with no further outbreaks. It's unclear why.
There are currently no treatments which can 'cure' RAS, though there are more than 30 medications routinely used to try to relieve the symptoms. A systematic review from 2012 found that no single medical systemic intervention is effective.
See: Systemic interventions for recurrent aphthous stomatitis Cochrane Systematic Review - Intervention , 2012.