Jeremiah 8:1

בָּעֵת הַהִיא נְאֻם ה’ ויוֹצִיאוּ אֶת עַצְמוֹת מַלְכֵי יְהוּדָה וְאֶת עַצְמוֹת שָׂרָיו וְאֶת עַצְמוֹת הַכֹּהֲנִים וְאֵת עַצְמוֹת הַנְּבִיאִים וְאֵת עַצְמוֹת יוֹשְׁבֵי יְרוּשָׁלִָם מִקִּבְרֵיהֶם

At that time, says Hashem, they will bring the bones of the kings of Judah, and the bones of his princes, and the bones of the priests, and the bones of the prophets, and the bones of the inhabitants of Jerusalem out of their graves.

The next few verses tell us that the exhumed remains will be spread out under the sun, moon and stars, which these people worshipped. (So, clearly, the prophecy only addresses idolaters.) Mahari Kara deduces from this that, for the sin of idolatry, the wicked are punished both in their lifetimes and afterwards as well.