Well it's not just the hell doctrine, but the afterlife has been a moot point through most of Jewish scripture and theology. In the books of the intertestamental period, Jewish beliefs in the idea of a general resurrection started showing up (including in books such as Daniel), but the idea is notably absent from the torah and vast majority of the OT
Well, the Torah was most probably written by a school of scholars around the time of Ezra who were trying to gain recognition from the local government (I think it was the Persians at that time). They wanted to make it seem as if their religion was much older than it was, so they drew together a bunch of ancient texts and added their own spin. In actual fact, monotheism had never been more than a temporary fad in the older Israelite religion; all the kings of Israel and most of the kings of Judah had sanctioned worship at local altars, which was forbidden by the later Torah. Sometimes they'd destroy some of the altars, but this was probably not a "return" to monotheism; it is more likely to have been a change in the favor of certain of the local pantheon. So for example a god of the hills might have been thought to have given them victory over a god of the plain, so they destroyed the altars to the god of the plain. Later authors probably edited that history to make it the rulers seem monotheistic.
As for the appearance of ideas of an afterlife in the later periods, this probably is a result of more freedom locally or a response to political pressure (the rulers believed in an afterlife and thought the Jews were lying) or possibly a response to the rulers being seen as unnecessarily harsh and restrictive--to deal with the problem of mass slaughter of Jews and Jews not being allowed to practice their religion openly, the religious authorities wanted the people to believe they would be rewarded for their faith sometime. Or possibly a combination of these factors.
For example, in modern Chabad Lubavitch belief, many believe that the last Lubavitcher rebbe (Menachem Mendel Schneerson) was the messiah. Their belief that he will return in glory to rule the world is very similar to Christian beliefs, and is probably based on them, as this movement was born in modern America and believes things atypical of Jewish texts. So it's a response to the pressures of the Christians and to the horrors of the holocaust. In an opposite example, the Sanhedrin's response to the death of Bar Kokhba, who had been declared the messiah by Rabbi Akiva, was to more or less banish Rabbi Akiva from the mainstream, because the Romans, who had killed Bar Kokhba, wanted to destroy anyone who held revolutionary views to prevent another uprising. If it had not been for this hunting of revolutionaries, the belief that Bar Kokhba was the messiah and would return one day to rule the world would probably have spread.