"God and his punishments" == "bad things that happen, life being unfair" etc.?
I read this as someone trying to give their condolences the best way they know how, according to their beliefs, in a language that is not their native tongue.
I reread what he wrote and I have to say on reflection you're probably right and my first reaction was probably too harsh. However, there is something wrong with expressing sympathies for a person's death by saying something that amounts to "yeah, that's because my imaginary FRIEND punished him". It implies the dead person was killed by an all-knowing supernatural force as a response to a transgression.