Why did God allow this to happen?

There is no question of punishment. God’s will for us is that we should have abundant life, not his condemnation.

Behind the question may be a sense of unfairness. Personal tragedy sometimes seems so random. So the old question haunts many who suffer: “Why me?”
Add, “It’s all so unfair” and we touch something of the rawness of life. But please remember this: God is not the author of turmoil and tragedy;
he did not place this situation on you or your loved ones. He is the one who rescues us -— who heals our tragic circumstances.
God’s answer to this mess is to reveal his nature as the healer, deliverer and redeemer of all who turn to him. With God, fresh starts are available. Jesus came to destroy the works of the devil (including all forms of ill–health), to bind up the broken–hearted and to set captives free. We enter into all this, which Jesus won for us by grace, through faith in him.