The scholars are agreed that Hajj and ‘Umrah are not obligatory for those who have not yet reached adolescence, because the Pen is lifted from children, as the Prophet (peace and blessings of Allaah be upon him) said: “The Pen is lifted from three (i.e., their deeds are not recorded): a child until he reaches adolescence; an insane man until he comes to his senses; and one who is asleep until he wakes up.” Narrated by Abu Dawood, 4403; Ibn Maajah, 2041.
With regard to the validity of a child’s Hajj, the correct view is that his Hajj is valid and he will be rewarded for it. This is the view of the majority of scholars, and it was narrated that there is consensus on this point.
Ibn ‘Abbaas narrated that the Prophet (peace and blessings of Allaah be upon him) met some riders in al-Rawha’ and said, “Who are these people?” They said, “Muslims.”
They said, “Who are you?” He said, “The Messenger of Allaah.”
A woman lifted up a child and said, “Is there Hajj for him?” He said, ‘Yes, and you shall have a reward.” Narrated by Muslim, 1336.
See also question no. 14621
For more information see Manaasik al-Subyaan, p. 6.