I'm not a biblical scholar or expert in the Ancient Near East, so feel free to ignore anything I'm about to write.
Along with acting as a conventional prophet, Jeremiah was a political commentator and foreign policy expert. He noted the moral failings of his society (especially the behavior of the political/social elites) and also advocated an alliance with Babylon. In the 6th C BC, Judah had two competing powers to align with. One was the traditional power in the Levant (Egypt) and the other was the latest Mesopotamia power (Babylon). Egypt was geographically closer and traditionally held more sway in Palestine, however, Babylon had the momentum. Jeremiah saw the shifting power structure and advocated for a close relationship to Babylon, telling the King not to put his faith in Egypt. Alas, like most prophets, Jeremiah was ignored, and the Judean King went with Egypt and Egypt did not come to rescue Judah.