Deserve What Get We Do
It doesn't matter if you're an atheist, devout follower of your faith, an agnostic or something in between -- there's wisdom to be learnt from the world's religions. Some of which are listed below:
The Jewish Talmud, for example, says:
What is hateful to you, do not do to your fellowman. This is the entire Law; all the rest is commentary.
This is the sum of duty; do naught onto others what you would not have them do unto you.
No one of you is a believer until he desires for his brother that which he desires for himself.
“Do not be deceived: God cannot be mocked. A man reaps what he sows. Whoever sows to please their flesh, from the flesh will reap destruction; whoever sows to please the Spirit, from the Spirit will reap eternal life”
All beings are the owners of their deeds (Karma), the heirs of their deeds; their deeds are the womb from which they sprang…Whatever deeds they do -- good or evil -- of such they will be the heirs.
Regarding the unfortunate in life:
The Christian bible says: If…there is a needy person among you…do not harden your heart and shut your hand against your needy kinsman. Rather, you must open your hand and lend him sufficient for whatever he needs. For there will never cease to be needy ones in your land, which is why I command you: open your hand to the poor and needy…
Buddha's final instructions on "The mission" set before us, for example, is to work for the happiness of others:
Go your ways, oh monks, for the benefit of many, for the happiness of many, out of compassion for the world, for the good, benefit and happiness of gods and men.
So in answer: It does matter what we do on this earth.
.