The 21-year-old was supposed to remain at the Anoeta for a second year, but Zinedine Zidane requested his return.
Madrid had an option to cut short the deal after one year, which they have do the disappointment of Sociedad.
The Madrid boss is so impressed by Odegaard that he plans to use him in the first team next season.
Zidane coached Odegaard while in charge of Real Madrid Castilla after the Norwegian arrived in 2015.
Odegaard threatened to go the way of many wonderkids after repeated loans to the Netherlands.
Odegaard had wanted to stay at La Real, but after chatting to Zidane they agreed he is ready to fight for a spot at Madrid.
Madrid could offer an olive branch to the disappointed Basque club by offering them another player on loan.