This passage is repeated almost verbatim in Hebrews 8:8-12. Jeremiah lived in the sixth and seventh centuries before Christ, some six hundred years before the New Covenant became a reality. The covenant that God commands forever in Psalm 111:9 is the covenant prophesied here in Jeremiah 31:31. It will endure forever, and it is the one associated with the law (the commandments of God).
In this prophecy, God shows that the New Covenant will be made with political entities—nations (Israel and Judah). In addition, it is obviously different from the one that Jeremiah's contemporaries were living under, otherwise there would be no need for a New Covenant. Hebrews 8 informs us that the reason for the New Covenant is to address the fault in it.
Please understand the major differences in the New Covenant that Jeremiah 31 brings out. God's laws will be written in the hearts of those who make the New Covenant. It is clear that the law was not written in the hearts of the ancient Israelites. Second, under it, there will be access to God and a personal relationship with Him.
Further, it strongly implies that there will be no privileged class who alone are set apart to teach. There will be no class distinction due to age or rank in the community. This is all encompassed within "every man shall know Me," meaning that everybody will have access to Him. It does not mean that there will be no ministry, as it is obvious from the New Testament that God gave—as a gift to the church—the ministry as a teaching vehicle. And finally, He mentions right at the end that sins will be forgiven.
Each of these elements is a promise of something not included in the Old Covenant. The average Israelite did not have access to God. They could not go into the place where God symbolically lived. They could not approach any closer than the court of the priests, who were intermediaries, a "privileged" class of men who went into God's presence for them. Nor could the blood of bulls and goats forgive sin (Hebrews 10:4). However, the New Covenant addresses these matters.