To a great extent, most, if not all, religions stress "giving back to the community" as a value that the divine demands out of the individual. The belief in God, organized religion, or individual spirituality helps to compel the individual to be altruistic. The reasons for this are many. One such reason is that the individual loses their sense of self- importance in subjugating it to the will of the divine. If the individual is less likely to view themselves as a small part of the cosmic configuration, it makes it easier to give to others. Put another way, if one believes that their presence is a gift from the divine, then material objects are secondary to this and thus, can be given away to the community or those less fortunate.
Another reason why a belief in God or religion helps people give to others is because spiritual worship is seen to help in constructing bonds between individuals. Rabbi Jonathan Sacks makes this rather compelling argument. In it, he argues that in contrast to modern individualism, religion and belief in the divine helps to form communities between individuals. The aspect of the divine and spiritual worship broadens the human psyche. In reveling in the power of the divine, we come to recognize other pilgrims who are on the same path that we are. This establishes a more communitarian ethos that forges connections, enabling individuals to give more freely to others. Rabbi Sacks articulates this condition that underscores the essence of the religious community:
Mr. Putnam’s research showed that frequent church- or synagogue-goers were more likely to give money to charity, do volunteer work, help the homeless, donate blood, help a neighbor with housework, spend time with someone who was feeling depressed, offer a seat to a stranger or help someone find a job. Religiosity as measured by church or synagogue attendance is, he found, a better predictor of altruism than education, age, income, gender or race.
It is in this where one can see how a belief in God, religion, and/ or spiritual worship can help people "give back to their community."
Belief in God can help people give back to their community, one can take the example of Islam, in which giving Zakat is given. Zakat can be defined as a 2.5% portion of one's wealth which is to be distributed among poor and needy people, only if that person is able to do so.
I believe the basic teachings of most of the great religious leaders are designed to encourage individual to behave in ways that harmonizes individual with the collective good of the society. Such teachings can be summarized in the christian advice to "do unto others as you would have them do unto you. I am sure belief in such ideals helps individuals to contribute - or give back - to their community, part of what they receive from them.