Jeremiah preached doom and destruction for forty long years, to such an extent that his name has entered our vocabulary, for someone whose very utterances foreshadow doom. Throughout most of his career, Jeremiah condemned the nation for paying tribute to the great powers who controlled the region, as only the help of God was needed. However, when Babylonian victory seemed assured, he counselled that Jerusalem’s only choice was to surrender, insisting that God wanted Judah to do the will of his servant, King Nebuchadnezzar of Babylon. In fact, he cursed any nation that tried to do otherwise.
In Jeremiah 37:12-13, the prophet was accused of attempting to leave Jerusalem in order to go over to the enemy. He insists that he was merely trying to visit a family property outside the city, but we find in Jeremiah 38:1-3 that he was preaching that everyone should go over to the Babylonians (Chaldeans), predicting a victory for the Babylonians:
Then ... heard the words that Jeremiah had spoken unto all the people, saying, "Thus saith the LORD, He that remaineth in this city shall die by the sword, by the famine, and by the pestilence: but he that goeth forth to the Chaldeans shall live; for he shall have his life for a prey, and shall live. Thus saith the LORD, This city shall surely be given into the hand of the king of Babylon's army, which shall take it."
Fortunately for Jeremiah, he had powerful friends who protected him, but it is understandable that he was seen as a traitor and almost killed. The Babylonians were no doubt aware of where his sympathies lay, so when they exiled most of the elite citizens of Jerusalem, they allowed Jeremiah to remain, even providing for him to be treated well.