The Morocco international centre-back leaves Roma for a reported 30million euro (£23.9million) transfer fee having played a key role as the Italian club finished second in Serie A last season.
The Bundesliga giants published an image of the 27-year-old signing his new contract through their official Twitter account on Wednesday evening.
Benatia has already described joining Bayern as a dream come true and emphasised his excitement at working under coach Pep Guardiola.
"I'm delighted that my transfer to Bayern has finally come off," he told Sport1 television. "It dragged out a bit and there were times when I thought it might fall through.
"But Guardiola desperately wanted me and I'm really looking forward to working with him.
"He's a fantastic trainer."
Benatia is also looking forward to working with a host of star names at the Allianz Arena.
"Bayern have so many great players," he said. "They have such a strong squad and it's a dream to be part of it."
Bayern moved for Benatia after Javi Martinez tore his cruciate knee ligaments during the German Supercup defeat to Borussia Dortmund, leaving them short on numbers at the back.
He joins the fit-again Holger Badstuber, Jerome Boateng and Dante as one of four centre-backs at the club.
Daniel van Buyten, who was on the books last season, left the club this summer and subsequently retired from football.