At that time Jeremiah had not yet been put into prison. So he was free to go anywhere he wanted.
Those rulers were very angry with Jeremiah and beat him. Then they put him in jail in the house of Jonathan the royal secretary, which had been made into a prison.