I've heard many times when something bad happens that it is God's punishment. I have similarly heard that God doesn't work that way. So what's fella to think? Does God punish or doesn't He? And the short answer is: He might, we just don't know if or when. And I think it's nonproductive to fret too much over that point.
Still, I think a better way to phrase the issue is, does God allow bad things to happen? Yet even then I'm not sure that allow is the correct term any more than I would automatically say that he causes them to happen. My point is. Sometimes things just happen, things which may be interpreted as punishment. And in fact, the corollary is also often true: sometimes good things just happen. It's interesting though that when good things happen folks aren't so quick to question the motives of the Almighty.
Be that as it may, the bottom line is that God wills what He wills, and we simply don't know when, where, and how He does that. Many if not most actions are simply the result of human free will, and nothing more. So how about we concede that we don't really know God's intent, but we do know our own, and work from there?