Shevuot (Oaths) 7 - Awareness of Impurity
If one knew that he was ritually impure, forgot about it and then visited the Temple or ate sacrifices, once he remembers his impurity - he is obligated to bring a "variable" sacrifice, the nature of which depends on his means.
If, however, he never recalls that he was impure, the goat that is brought as a sacrifice on Yom Kippur, and the day of Yom Kippur itself, suspends his punishment. When he finally does find out about his past impurity, he then brings a "variable sacrifice."
But maybe the goat of Yom Kippur atones even for idol worship, prohibited relations, and bloodshed, because these are also characterized as "impure"? - No! Yom Kippur atones only "from impurities of the Children of Israel," but not all impurities - these are the words of Rabbi Yehudah. Rabbi Shimon derives the same answer from the context of Yom Kippur - it atones only for matters related to the Temple service.
Art: Theodore Robinson - Girl with a goat