Jeremiah's letter to the exiled Jewish community in Babylon (JER 29:1-23) advises the captives to settle into their captivity rather than fight against it. He tells them to build houses and plant fields, to get married and have children, even grandchildren, in that foreign land. Instead of resisting their situation, they should accept it—more than that, they should be grateful for it, for the Lord is offering His people a way back into His favor.
A little context is useful here. The twelve tribes of Israel were historically divided into two parts. Ten of the tribes formed the northern kingdom of Israel, while the two remaining tribes made up the kingdom of Judah. Israel and Judah together followed the faith of YHWH, and although they were different political entities, they were both the homelands of the Jewish people. What happened in one kingdom affected the other.
Strict adherence to the faith of YHWH was a moral requirement for all twelve tribes, but time and again, the Bible recounts how the people strayed from the Lord and disobeyed His commandments. The Lord sent prophets such as Hosea and Amos to warn the people that they must renounce their idolatrous, immoral behavior and beg the Lord's forgiveness or face the consequences of their sins. According to the Biblical narrative, the prophets were largely ignored, and a little more than a century before the Babylonian Exile, in approximately 740 BCE, the northern kingdom of Israel was invaded and destroyed by the Assyrian king Sargon II. The majority of its population was forcibly relocated to other parts of the Assyrian empire, and ten of the twelve original tribes were now lost forever.
The fate of the kingdom of Israel should have warned the people of the kingdom of Judah of what might befall them if they continued to worship false gods, but although there were temporary religious reforms under King Josiah, the Judeans ultimately returned to their former behavior. The Lord therefore made Jeremiah His prophet to spread the message that what had happened to Israel would happen to Judah as well if the people did not change their ways.
As in Israel, nobody in Judah listened to the warnings, and King Nebuchadnezzar of Babylon invaded and conquered Judah circa 597 BCE. After the conquest, the most powerful part of Judean society (the wealthy, the educated, and the priests) were deported to Babylon as captives. It is to these people that Jeremiah's message was written. He advises them that now is not the time to fight against their situation, because they brought this situation on themselves through their sins:
... because they did not heed my words, says the Lord, when I persistently sent to you my servants the prophets. (JER 29:19)
Instead, they must submit to the Lord's will by accepting their punishment as captives and making the best of their circumstances. By settling down, establishing roots and having families, the people will ensure that they survive in captivity long enough for the Lord to bring their descendants back to their homeland.
Thus says the Lord [...] seek the welfare of the city where I have sent you into exile, and pray to the Lord on its behalf, for in its welfare you will find your welfare. (JER 29:4-7)
Therefore the captives must not believe in any "false prophets" who tell them that their exile will end soon:
For surely I know the plans I have for you, says the Lord, plans for your welfare and not for harm, to give you a future with hope. (JER 29:11)
In His mysterious way, the Lord has actually sent the captives into exile to save them. So long as they keep the faith and trust in the Lord, He will deliver them from exile when He deems the time is right.