"And Moses said: Though ye and all who are in the earth prove thankless, lo! Allah verily is Absolute, Owner of Praise."
(Quran, 14:8).
The word absolute stands for the word "غنی" (ghani) in arabic which is also translated as "self-sufficient", "independent", and "free of all needs".
So God can stand watching people sin. Even if all the people on earth turn away from him, and he won't be affected. So it's not for himself that he set punishments as an obvious result of sin. It's just that he's so much nice that he wants everyone to be good and to enjoy the results; that is the joy of living in heaven, close to God and having him satisfied of you, which might not be so easy for us to realise now how good it is.
We can't judge that God is cruel because he kills. The actual punishment is after death; and more interestingly it is not as though if God gives the unbelievers more time to live, it's for his mercifulness; he just gives them more time to sin!; at least you can say in this case he's just merciful to their bodies:
"And let not those who disbelieve imagine that the rein We give them bodeth good unto their souls. We only give them rein that they may grow in sinfulness. And theirs will be a shameful doom."(Quran, 3:178)
It is only for believers and those who are hoped to become one, that this extra time is good; otherwise it will add to their punishment in hell.
And so if you see someone die young, you can't say he was a sinner. He might have been just too good that God wanted to take him to himself before he'd ruin his soul by sin.