The question of why there is evil in the world was never discussed by the ancient philosophers of Egypt, Babylon, Persia, Greece or Rome. They were polytheists who had a pantheon of gods. Evil was the result of conflicts between the gods. For example, the historical account of the war on Troy was reported by the Greeks as the result of jealously and rivalry between three goddesses.
However, with the understanding of a Holy and loving God, which was a Hebrew concept revealed through the prophets of Israel, the question of how there could be evil in the world began to be discussed. The book of Job is the oldest Theodicy that we know of. A Theodicy is a defence of the justice of God in the light of evil in the world. How can evil and suffering exist when God is all powerful and all good?
Sin and Suffering
The friends of Job had a legalistic explanation that the reason Job was suffering so terribly was because he must be guilty of terrible sin. God severely rebuked these false counsellors and vindicated Job as a blameless man targeted by satan.
When the disciples saw a man who was blind from birth, they asked Jesus: “Rabbi, who sinned, this man or his parents, that he was born blind?” Jesus answered, “Neither this man nor his parents sinned, but that the works of God should be revealed in him.”