Bayern do not have the option to buy Odriozola at the end of his loan spell and he will return to the Spanish capital when the 2019/2020 season concludes.
The 24-year-old has featured sparingly for Real Madrid this season, making just five appearances in all competitions for Zinedine Zidane’s men.
Odriozola has not played in La Liga at all since getting sent off in a 1-0 defeat to Real Mallorca in the middle of October.
He joined Real Madrid from Real Sociedad in the summer of 2018 but has been unable to dislodge Dani Carvajal as the club’s first choice right back.
Odriozola becomes Hansi Flick’s first signing for Bayern Munich in the winter transfer window and he will be eligible for the remainder of the Champions League campaign despite having already featured in the competition for Real Madrid.
"We agreed to follow the wishes of head coach Hansi Flick in strengthening the defence and decided to go for Alvaro Odriozola" Bayern chairman Karl-Heinz Rummenigge said. "We are delighted about the signing."
Bayern sporting director Hasan Salihamidzic added: "We are convinced Alvaro Odriozola will help our team with his qualities. I am very happy we've found a full-back like him."
Having made the Spain squad for the 2018 FIFA World Cup in Russia, Odriozola will be hoping his mid-season switch brightens his chances of featuring in Luis Enrique’s plans for EURO 2020.