I am trying to determine the most ancient extant source for the concept of Hell as a place of spiritual cleansing. Regardless of what term you use for it (etc. ,גיא בן הינום, שְׁאוֹל), I understand that most Jews teach that Hell is a place of spiritual cleansing prior to entering the world to come (גַּן עֵדֶן "heaven," העולם הבא, etc.). What I am wondering is how far back this teaching can be substantiated. Who is the most ancient source making this claim and approximately what time period was it made? For instance, another user mentioned Nachmanides in Sha'ar HaGemul quoting Pirkei D'Rabbi Eliezer concerning שְׁאוֹל as well as some other sources, when would these have been written (approximately)? Are there any older sources?
What is the earliest commentary we have that recognized Hell as a place for cleansing the soul?
Pirkei deRabbi Eli'ezer is a compilation of midrashim [rabbinic allegory and exegesis], and the dating is questionable but scholars generally assign it to the eighth or ninth century. My reading of that source, though, doesn't say anything about Sheol as a place of cleansing the soul, but simply that Sheol is the lowest of the seven levels of Gehinnom.
As for your question, one of the earliest Jewish sources in my mind would be the (Babylonian) Talmud (completed circa 500 CE). The (Hebrew) Bible doesn't mention anything about She'ol as a place of cleansing — in the TaNaKh, She'ol is simply the place where a person's life-force goes when they die. In the Talmud, however, we read (Rosh haShana 16b-17a):
The entirely righteous will be inscribed and sealed definitively for everlasting life, the entirely wicked will be inscribed and sealed definitively for Gehinnom... But the average people [beinonim] will go down to Gehinnom, [until they] cry out [in prayer - the word here is metsaphtsephin, and the meaning is not entirely clear], and then they will rise up.
Later on this same page, the rabbis discuss the different kinds of people who go to Gehinnom and the lengths of time they need to spend there.
I'm far from a Talmudic scholar, so I'm sure the other knowledgeable users on this site will have additional, illuminating comments to add.
The belief in reward and punishment in the afterlife is a fundamental tenet of the Jewish faith (11th Principle of Rambam's 13 Principles of Faith). The earliest references I know of are various references in the Babylonian Talmud. Rosh Hashana 16b-17a attributes the view to Bais Shammai (ca 1st Century C.E.). Rabbi Akiva (ca 40 CE - ca 137 CE) is a bit more specific about how the non-wicked but less than righteous would be cleansed in Gehinnom for not more than 12 months. Mishna, Eduyos 2:10.
Although the books of the Tanach (i.e. the Hebrew Bible) allude to the afterlife, as the Talmudic citations above reveal, it is not very specific which is one reason the Sadducee sect refused to recognize the concept. See Josephus, Antiquities of the Jews, Book 18 Chapter 1. Our sages of the late Second Temple (sometimes known as the Pharisees), held to the belief in reward and punishment after death as a lesson of the Oral Torah -- the unwritten detailing of laws given by G-d to Moses and passed down generation to generation thereafter.
Chagigah 15B - Soncino translation - (emphasis mine):
When Aher died, they said: Let him not be judged, nor let him enter the world to come. Let him not be judged, because he engaged in the study of the Torah; nor let him enter the world to come, because he sinned. R. Meir said: It were better that he should be judged and that he should enter the world to come. When I die I shall cause smoke to rise from his grave. When R. Meir died, smoke rose up from Aher's grave. R. Johanan said: [What] a mighty deed to burn his master! There was one amongst us, and we cannot save him; if I were to take him by the hand, who would snatch him from me! [But] said he: When I die, I shall extinguish the smoke from his grave. When R. Johanan died, the smoke ceased from Aher's grave. The public mourner began [his oration] concerning him thus: Even the janitor could not stand before thee, O master!