During the Second Temple period, Torah scroll was considered to be a source of ritual impurity? Today this is not the case. When did this halakha change?
In actuality the halacha still applies today. This law can be found in the Shulchan Aruch Chapter 147, section 1 and is derived from the Talmud, tractate Megilla 32a.
We can see the discussion in Megillah 7a - Kisvei HaKodesh Making Your Hands Tamei
Where does this halacha of kisvei hakodesh being metamei come from and why? Rashi references the sugya in Shabbos 14a. The gemara in Shabbos says there were two independent gezeiros made on kisvei hakodesh. One was that it is metamei Terumah because there was a tendency to store the Terumah next to the Torah in the Aron Kodesh causing mice to nibble at the Torah when they went to eat the Terumah. Therefore, chazal were gozer tu'mah on the Torah that it would be metamei teruma as a way to prevent people from putting the Terumah next to the Torah in the Aron. A second gezeira that was made was that a Torah would be metamei one's hands. The rationale for this the gemara explains has nothing to do with Terumah, rather it is based on the din of R. Pranach - האוחז ס"ת ערום נקבר ערום בלא אותה מצוה. One who holds a bare Sefer Torah is punished that whatever mitzvah they were doing while holding the Torah, they lose reward for that mitzvah. Rashi explains that people's hands were generally dirty (not necessarily tamei) and they would touch the Torah with dirty hands, which is why R. Pranach said that it is assur. To prevent people from touching a Torah with dirty hands, they were gozer tu'mah on kisvei hakodesh. Since one's hands would be come tamei by touching the scroll, they would refrain from touching it.
Tosafos (Shabbos 14a) writes that the din of R. Pranach applies equally to all kisvei hakodesh from the simple fact that chazal were gozer that ALL kisvei hakodesh would make one's hands tamei. Rashi in Megilla implies that as well.
The Gemara in Masechet Shabbat (14) cites a Halacha in the name of Rabbi Parnach forbidding touching the parchment of a Torah scroll barehanded. One who must touch the scroll must do so indirectly, while holding some material in his hand, such as a cloth or Tallit. The Gemara warns that a person who touches the scroll barehanded forfeits the Misva in which he is involved, Heaven forbid. Thus, for example, if a Sofer (scribe) is writing a Sefer Torah, or if somebody studies from the scroll, lifts it to show it to the congregation, or rolls it, he forfeits the merit of the Misva if he directly touches the scroll while performing that Misva.
The Shulhan Aruch (Orah Haim 147:1) codifies this Halacha (listen to audio recording for precise citation), and adds that it applies even if one washes his hands just before handling the Sefer Torah. One might have thought that this issue depends solely on the Tum’a (impurity) of one’s hands, such that it would be permissible to directly touch the scroll after performing Netilat Yadayim. According to the accepted Halacha, however, even immediately after performing Netilat Yadayim it is forbidden to directly touch the scroll.
The exception to this rule is the scroll of Megilat Ester. Although the prohibition against directly touching a Torah scroll applies also to the Megila, Hacham Ovadia Yosef rules (based on the Kaf Ha’haim) that the one who reads Megilat Ester may touch the scroll after washing his hands, as the Megila may be treated more leniently than a Sefer Torah.
Summary: It is forbidden to directly touch the parchment of a Sefer Torah; one who must touch the scroll should make sure to do so indirectly, while holding a cloth or his Tallit. This applies even if one washed Netilat Yadayim. However, one may directly touch a Megilat Ester after performing Netilat Yadayim without a Beracha.
It's not really that the law has changed; it's just that it's become rather moot.
The problem was that people would store their holy scrolls (Torah or other parts of Nach) with the "holy food" in the house, i.e. the tithes that had to be given to a Kohen. The problem is that pests eating the food would damage the scrolls. The rabbis therefore decreed that the scrolls were just impure enough that they would contaminate "holy food", forcing people to keep the scrolls away from the holy food. It's highly technical, but here are the mechanics, roughly: a corpse is contamination level -1, a dead lizard level 0, a contaminated clay pot, or a person who touched a dead lizard, level 1; contaminated normal food, level 2; contaminated tithings are level 3, and contaminated sacrifices are level 4. (I'm following Talmudic nomenclature here, in which lower levels are stronger; sorry it's confusing.) The scrolls were declared to be Level 2, which contaminate tithings (Level 3) but not ordinary food (can only become a Level 2 by touching a Level 1 or stronger).
If a person touches weak-level impurity, they remedy the situation by washing their hands. There is some discussion about washing hands concerning those who directly handle a scroll, but otherwise it's pretty moot today. We're all sufficiently contaminated (usually at Level 0) today that we don't really care. A Kohen is only prohibited from exposure to a corpse, not scrolls.
I asked this question to a rabbi last week. He said that people used to store their torahs in the safest, most water resistant part of their dwelling- the pantry. Apparently scrolls were being damaged by rats in the pantry so they made this decree so people would find the mixture of food and scrolls repugnant. Apparently tosafos says this.