Jeremiah knew that if God punished his own people, he would not leave unpunished the other nations (Jeremiah 25:29). That is why he closes this song with hope for Israel, but judgment over Edom.
Edom and Israel came from the brothers Esau and Jacob. Although the two peoples were closely related, they were never good neighbours. When Jerusalem fell, Edom gloated and even helped to destroy the people of Judah (Psalm 137:7; Ezekiel 36:5; Joel 3:19; Obadiah 1:12).
In Scripture, the judgment of God is often presented as a cup of wine that one must drink empty (Psalm 60:5; Psalm 75:9; Isaiah 51:17; Jeremiah 25:15–29). Jeremiah warns Edom that this cup will also come to them, and that they will be put to shame. About 100 years after the fall of Jerusalem, the beautiful land of Edom had changed into a desert (Malachi 1:3–4). Possibly, it also fell victim to Babylonian violence.
21 Rejoice and be glad, O daughter of Edom, you who dwell in the land of Uz; but to you also the cup shall pass; you shall become drunk and strip yourself bare.