Jeremiah 12:16
And it shall come to pass, if they will diligently learn the ways of my people, to swear by my name, The LORD liveth; as they taught my people to swear by Baal; then shall they be built in the midst of my people. And it shall come to pass, if they will diligently learn the ways of my people, to swear by my name, The LORD liveth; as they taught my people to swear by Baal; then shall they be built in the midst of my people.
The promise concerns the surrounding nations that had harmed Israel and that had taught God's people to swear by Baal. If those nations will diligently learn the ways of God's people, to swear by the Lord's name, turning from Baal to worship the Lord faithfully, then they shall be built and established in the midst of God's people. Their place among God's people depends on conduct rather than birth, and if they refuse to obey they will be utterly destroyed.
Swearing by God's name is permitted as a solemn oath, and this swearing by the Lord's name is an example of that kind of lawful oath.