In one of his aspects, God appears as Mother nature who sets boundaries her children must not cross. If they do cross them, it is said that God punishes them.

This is not so, for they are the ones who left the enclosure sheltering and protecting them, and in so doing they put themselves in danger.
Humans must stop thinking that the acts they commit are foreign to them, and that once they have done something, they are free of it. No, whether it be good or bad deeds, even if they escape human justice, their errors will leave indelible traces behind within them.

If they wish to experience divine love and kindness, there is only thing to do: they must not err; and if they do, they must realize their mistakes and make amends.

Omraam Mikhaël Aïvanhov