When the Chaldean army withdrew from Jerusalem because of Pharaoh's army,
References for Jeremiah 37:11
Jeremiah [started to] leave Jerusalem to go to the land of Benjamin to claim his portion there among the people.
References for Jeremiah 37:12
But when he was at the Benjamin Gate, an officer of the guard was there, whose name was Irijah son of Shelemiah, son of Hananiah, and he apprehended Jeremiah the prophet, saying, "You are deserting to the Chaldeans."
"[That's] a lie," Jeremiah replied. "I am not deserting to the Chaldeans!" Irijah would not listen to him but apprehended Jeremiah and took him to the officials.
The officials were angry at Jeremiah and beat him and placed him in jail in the house of Jonathan the scribe, for it had been made into a prison.
References for Jeremiah 37:15
So Jeremiah went into a cell in the dungeon and stayed there many days.
References for Jeremiah 37:16