If we are speaking of suffering in general, whole books have been written in answer to this question. Our own Immanuel Can wrote
an open letter about it to conservative author Dinesh D’Souza in 2016. If you are looking for a philosophical explanation for the necessity of pain in a fallen world, you may find it there.
One thing we can be sure of: the answer is not simple. Another thing we can be sure of is that people who observe
suffering are bound to speculate about its cause. It’s human nature. Perhaps
you remember the question Jesus’ disciples asked upon encountering a blind man:
“Rabbi, who sinned, this man or his parents?”
They were wrong, of course. Those are far from the only two options.