The elect, not just out of Judah but out of all nations, shall flow into the exalted mountain of God's church. There they will be taught the ways of the Lord. As a fruit of this teaching, they will walk in the paths of God. The reason is that out of Zion will go forth the law, and the word of the Lord from Jerusalem. He mentions a part for the whole.
Law means instruction.
It is the Word of God as that Word expresses God's will for His saints in Christ. That will is summed in God's law. How the godly remnant needed this. Not only would they be sorely tried in the captivity of Babylon, but that would continue after the remnant returned to Judah. It did not take long before the false prophets and priests again held sway in Israel.