It was a test of faith. Obviously God wasn't going to let him sacrifice his son as he provided the ram for him instead and God forbade such a practice later on in the Bible
Deuteronomy 18:10 ESV / 300 helpful votes
There shall not be found among you anyone who burns his son or his daughter as an offering, anyone who practices divination or tells fortunes or interprets omens, or a sorcerer
2 Kings 21:6 ESV / 146 helpful votes
And he burned his son as an offering and used fortune-telling and omens and dealt with mediums and with necromancers. He did much evil in the sight of the Lord, provoking him to anger.
Deuteronomy 12:31 ESV / 137 helpful votes
You shall not worship the Lord your God in that way, for every abominable thing that the Lord hates they have done for their gods, for they even burn their sons and their daughters in the fire to their gods.