Literally, he didn't ask him to slaughter him, just to bring him up on the alter as a sacrifice.
The whole thing was a test of faith whether he would listen to Gd with a good heart for such a painful test.
Here's a quote from the chovos halevavos shaar cheshbon hanefesh chapter 3 way#27
Know, my brother, that for the ten tests which G-d tested Avraham our
forefather with, we would not be praising Avraham for standing up to
these tests, if it were not the case that he received everything from
his G-d willingly and with a good heart, as written: "And found his
heart faithful before You" (Nechamia 9:8), and the generation who left
Egypt did not become deserving of culpability and rebuke in the desert
if not that they became angry and their hearts was not good with G-d
and His prophet, ("even though they accepted everything that came to
them and did not sin in speech, but their hearts were always grudging
against G-d and they did not desire in His decrees but were like one
who is forced to accept against his will" - TovLevanon comentary), as
written: "But they beguiled Him with their mouth, and lied unto Him
with their tongue" (Tehilim 78:36), and many times they would show
their grudging and rebelliousness against G-d and the breaching of His
covenant, as we find them constantly desiring to return to Egypt, or
the like. Good bearing is a good character trait but one who bears
(begrudgingly) out of force does not receive any reward for it, and he
does not attain forgiveness from it ("G-d does not forgive his sins
due to the suffering that came to him since he does not accept them
contently but only out of being forced" - T.L.).
http://dafyomireview.com/article.php?docid=391#ch3_27