Jeremiah 34:6

Then Jeremiah the prophet spake all these words unto Zedekiah king of Judah in Jerusalem,

Jeremiah spoke all of God's words to Zedekiah king of Judah in Jerusalem during the Babylonian siege, late in his work in Judah. It belongs to the historical section of Jeremiah dealing with the reign of Zedekiah and the events of the two years before Jerusalem fell.
In chronological order chapter 34 comes after chapter 21 and before chapter 37, even though it follows chapter 33 in the book. The prophecies after chapter 20 were gathered together from manuscript rolls into one book without chronological order, and this displacement makes no change in the teaching, since the timing is made clear by the chapter itself.
The message it introduces called for a covenant to proclaim liberty and to free Hebrew male and female servants. That undertaking included the release of servants and others who were oppressed or in debt, in keeping with the law given through Moses, and the people at first obeyed. It is counted among Jeremiah's prophecies that point to the same time as Ezekiel's promises of Israel's gathering, deliverance, and renewal.