The phrase “law and prophets” is an expression used to refer to the Hebrew Scriptures— the Old Testament. The Hebrew Scriptures are divided into three parts— Law, Prophets and Writings:
The phrase “Law and Prophets” is used several times in the New Testament to refer generally to these collections of books.
“Don’t think that I came to destroy the law or the prophets. I didn’t come to destroy, but to fulfill. For most assuredly, I tell you, until heaven and earth pass away, not even one smallest letter or one tiny pen stroke shall in any way pass away from the law, until all things are accomplished.” (Matthew 5:17–18 WEB)
In Matthew 5:17, Jesus is saying “don't think that I cam to destroy the Scriptures”. In this text, “law“ means Genesis, Exodus, Leviticus, Numbers and Deuteronomy— the Torah. “Not the smallest letter or one tiny pen stroke shall in any way pass away from the Torah”.
Here are a few translations that make this meaning clearer.
CJB — Don’t think that I have come to abolish the Torah or the Prophets. I have come not to abolish but to complete. Yes indeed! I tell you that until heaven and earth pass away, not so much as a yud or a stroke will pass from the Torah — not until everything that must happen has happened.
ERV — Don’t think that I have come to destroy the Law of Moses or the teaching of the prophets. I have come not to destroy their teachings but to give full meaning to them. I assure you that nothing will disappear from the law until heaven and earth are gone. The law will not lose even the smallest letter or the smallest part of a letter until it has all been done.
GW — Don’t ever think that I came to set aside Moses’ Teachings or the Prophets. I didn’t come to set them aside but to make them come true. I can guarantee this truth: Until the earth and the heavens disappear, neither a period nor a comma will disappear from the Scriptures before everything has come true.
NLV — Do not think that I have come to do away with the Law of Moses or the writings of the early preachers. I have not come to do away with them but to complete them. I tell you, as long as heaven and earth last, not one small mark or part of a word will pass away of the Law of Moses until it has all been done.
TLV — Do not think that I came to abolish the Torah or the Prophets! I did not come to abolish, but to fulfill. Amen, I tell you, until heaven and earth pass away, not the smallest letter or serif shall ever pass away from the Torah until all things come to pass.
It should be clear in the following texts that “law and prophets” means the Scriptures, generally.
“Therefore whatever you desire for men to do to you, you shall also do to them; for this is the law and the prophets.” (Matthew 7:12 WEB)
“The whole law and the prophets depend on these two commandments.” (Matthew 22:40 WEB)
“He said to them, “This is what I told you, while I was still with you, that all things which are written in the law of Moses, the prophets, and the psalms, concerning me must be fulfilled.”” (Luke 24:44 WEB)
“Philip found Nathanael, and said to him, “We have found him, of whom Moses in the law, and the prophets, wrote: Jesus of Nazareth, the son of Joseph.”” (John 1:45 WEB)
“After the reading of the law and the prophets, the rulers of the synagogue sent to them, saying, “Brothers, if you have any word of exhortation for the people, speak.”” (Acts 13:15 WEB)
“But this I confess to you, that after the Way, which they call a sect, so I serve the God of our fathers, believing all things which are according to the law, and which are written in the prophets” (Acts 24:14 WEB)
“When they had appointed him a day, many people came to him at his lodging. He explained to them, testifying about the Kingdom of God, and persuading them concerning Jesus, both from the law of Moses and from the prophets, from morning until evening.” (Acts 28:23 WEB)
“But now apart from the law, a righteousness of God has been revealed, being testified by the law and the prophets” (Romans 3:21 WEB)