Let's say the world is morally ordered if good things come to those who act morally well and bad things come to those who act morally badly.
Moral order admits of degrees. We might say that the world is perfectly morally ordered if everyone gets exactly what they morally deserve, perfectly immorally ordered if everyone gets the opposite of what they morally deserve, and has no moral order if there's no relationship between what one deserves and what one gets.
Moral order might vary by subgroup of individuals considered. Perhaps the world is better morally ordered in 21st century Sweden than it was in 1930s Russia. Perhaps the world is better morally ordered among some ethnicities or social classes than among others. Class differences highlight the different ways in which moral order can fail: Moral order can fail among the privileged if they do not suffer for acting badly, can fail among the disadvantaged if they do not benefit from acting well.
Moral order might vary by action type. Sexual immorality might more regularly invite disaster than financial immorality, or vice versa. Kindness to those you know well might precipitate deserved benefits or undeserved losses more dependably than kindness to strangers.
Moral order can be immanent or transcendent. Transcendent moral order is ensured by an afterlife. Immanent moral order eschews the afterlife and is either magical (mystical attraction of good or bad fortune) or natural.
Some possible natural mechanisms of immanent moral order:
* A just society. Obviously.
* A natural attraction to morality of the sort Mencius finds in us. Our hearts are delighted, Mencius says, when we see people do what's plainly good and revolted when we see people do what's plainly wrong. Even if this impulse is weak, it might create a constant pressure to reward people for doing the right and revile them for doing the wrong; and it might add pleasure to one's own personal choices of the right over the wrong.
* The Dostoyevskian and Shakespearian psychological reactions to crime. Crime might generate fear of punishment or exposure, including exaggerated fear; it might lead to a loss of intimacy with others if one must hide one's criminal side from them; and it might encourage further crimes, accumulating risk.
* Shaping our preferences toward noncompetitive goods over competitive ones. If you aim to be richer than your neighbors, or more famous, or triumphant in physical, intellectual, or social battle, then you put your happiness at competitive risk. The competition might encourage morally bad choices; and maybe success in such aims is poorly morally ordered or even negatively morally ordered. Desires for non-competitive goods -- the pleasures of shared friendship and a good book -- seem less of a threat to the moral order (though books and leisure time are not free, and so subject to some competitive pressures). And if it's the case that we can find as much or more happiness in easily obtainable non-competitive goods, then even if wealth goes to the jerks, the world might be better morally ordered than it at first seems.
How morally ordered is the world? Do we live in a world where the knaves flourish while the sweethearts are crushed underfoot? Or do people's moral choices tend to come back around to them in the long run? No question, I think, is more central to one's general vision of the world, that is, to one's philosophy in the broad and and proper sense of "philosophy". All thoughtful people have at least implicit opinions about the matter, I think -- probably explicit opinions, too.
Yet few contemporary philosophers address the issue in print. We seem happy to leave the question to writers of fiction.