In order to better understand what Jesus means in Matthew 19:8, it is profitable to consider why the Pharisees were trying to trap Jesus. They asked him if it was lawful for a man to divorce his wife “for any and every reason”. This comment is made in the New International Version Study Bible regarding Matthew 19:3. Matthew was writing to the Jews...
...who were aware of the dispute between the schools of Shammai and Hillel over the interpretation of Deuteronomy 24:1-4. Shammai held that “something indecent” meant “marital unfaithfulness” – the only allowable cause for divorce. Hillel (c. 60 B.C. – A.D. 20) emphasised the preceding clause, “who becomes displeasing to him”. He would allow a man to divorce his wife if she did anything he disliked – even if she burned his food while cooking it. Jesus clearly took the side of Shammai (see verse 9), but only after first pointing back to God’s original ideal for marriage in Genesis 1:27; 2:24.
The Hebrew phrase used in Deuteronomy 24:1 was usually a reference to sexual indecency such as adultery (Leviticus 18:6-18) or indecent exposure (Deuteronomy 23:14). When Jesus responded to the Pharisees he reminded them that it was never God’s intention for a man to divorce his wife. The “beginning” in Matthew 19:8 refers to Adam and Eve who had been joined together in a lifelong union.
Though divorce was not part of God’s original plan for marriage, sinful humanity demanded it, and the Mosaic Law addressed occasions when it was permissible. Jesus and the New Testament teachings affirm the original intent of marriage as being a lifelong relationship between a man and woman while specifying limited occasions when divorce is acceptable. Source: https://www.gotquestions.org/Deuteronomy-24-divorce.html
Malachi 2:13-16 is also worth considering. God hates divorce because marriage is not a contract. Marriage is a covenant and divorce destroys the whole concept of this important covenant. Here is a brief extract from an article on this point:
Marriage is a picture of the covenant God has with His people (Hebrews 9:15). A covenant is an unbreakable commitment, and God wants us to understand how serious it is. When we divorce someone with whom we made a covenant, it makes a mockery of the God-created concept of covenant relationship. The Church (those individuals who have received Jesus as Savior and Lord) is presented in Scripture as the “Bride of Christ” (2 Corinthians 11:2; Revelation 19:7-9). We, as His people, are "married" to Him through a covenant that He established. A similar illustration is used in Isaiah 54:5 of God and Israel.
When God instituted marriage in the Garden of Eden, He created it as a picture of the greatest unity human beings can know (Genesis 2:24). He wanted us to understand the unity we can have with Him through redemption (1 Corinthians 6:17). When a husband or wife chooses to violate that covenant of marriage, it mars the picture of God’s covenant with us.
When Jesus was asked why the Law permitted divorce, He responded that God had only allowed it "because of the hardness of your hearts, but from the beginning it was not so" (Matthew 19:8). God never intended divorce to be a part of human experience, and it grieves Him when we harden our hearts and break a covenant that He created. Source: https://www.gotquestions.org/God-hates-divorce.html
Moses wasn’t making it up as he went along; rather God himself is the author of the Mosaic Law that was given to His people through Moses, his spokesman. If Moses had exceeded the authority ascribed to him by God, then Jesus, God incarnate, would not have told the hypocritical Pharisees that although Moses “allowed” for divorce in the Law it was never part of God’s divine plan for men to divorce their wives. That God permits divorce (on the basis of adultery) even though he hates divorce suggests that God Himself made allowances by making provision for divorce within the Law.
Jesus' words have significance, not regarding the integrity of the law that God gave to Moses, but to the manner in which men have hardened their hearts against God’s binding covenants, marriage being one of them. Jesus reminds us that there are occasions when God permits His people to do things that grieve Him. Also, Jesus’ words remind us that marriage is a serious, life-long covenant.