In countries with strong economies and a large middle class, the public is more prone to demand honesty and integrity from it's politicians. They are the contributors to political campaigns and ultimately have the ability to fund and carry out a revolt when the military takes political control.
In poor countries, people are struggling to survive and offer very little threat to the armed forces and the police. For that reason, a strong economy with a fairly equal distribution of wealth would lead to a more democratic government.