If you believe any of these holds true as a rule, you may be a victim of the just-world fallacy (sometimes referred to more charitably as a "hypothesis").
Even other species of primates hold a sense of fairness as part of their core identity. In a 2010 study, chimpanzees were trained to exchange tokens for a food reward—either a piece of carrot (low reward) or a grape (high reward). When one chimp was given a grape and the other a carrot, the latter was more likely than in the "fair" control group to refuse the reward after seeing what the other received. Interesting, but maybe not too surprising. But here's what's really fascinating: In this highly competitive species, even the chimp that received the grape was significantly more likely to refuse their reward.
If such a powerful sense of justice exists in chimps, it's no wonder that this concept is integral to human society. The problem comes in when our sense of justice collides with our tendency to ascribe agency where it doesn't belong. What happens when tragedy strikes but there's no one to blame? Or when the bad guy gets away, figuratively or literally, with murder? That's when the just-world fallacy kicks in.
If a natural disaster strikes a major city, fundamentalists are prone to interpreting it as divine punishment after the fact. Hurricane Katrina is a prime example. No less than five different motivations were offered for God's wrath: sexual immorality, abortion, racism, failure to support Israel, and (from al-Qaeda) America's attacks on al-Qaeda.
When human justice fails to punish evil deeds, religion offers a comfortable alternative: divine retribution in this life or the next. Hinduism, Buddhism, Sikhism and Jainism each have their own concept of karma and reincarnation, which, while not always directly caused by God, generally involve the accumulation of positive or negative consequences depending on one's actions. And contrary to what some Christians believe, the Bible repeatedly states that believers will be judged according to their works.
Perhaps most disturbingly, the just-world fallacy can cause people to blame the victim of a crime rather than the perpetrator, believing that they must have deserved it in some way since no visible justice was served. If a woman is raped, maybe she was "asking for it" by her choice of dress. In cases of spousal abuse, maybe she had done something wrong to warrant that treatment. It's a terrifying rationale, and one that we should be doing our best to eradicate.
Religion is far from the sole factor here, but it certainly plays a role. When one believes that a god or other mystical force maintains perfect moral order in the universe, one has to explain injustices somehow. But by rationalizing horrible crimes and misfortunes, just-worlders throw a wrench into the already chaotic workings of human justice. Only when we realize that humanity alone is burdened with the task of punishing criminals and aiding victims can we hope to achieve a truly fair and equitable society.