The Serie A champions have paid $3.3m (£2.5m) for the loan spell and have the choice to buy him for $18.8m (£14.3m) next summer.
The 29-year-old returns to Italian football after spells at Udinese and Roma, whom he left for Bayern in 2014.
He made 23 appearances for the Bundesliga winners last season.
He had hinted earlier this year that he would consider his future after Bayern re-signed Germany defender Mats Hummels from rivals Borussia Dortmund.
Benatia was born in France but opted to play for Morocco at international level and has now earned 42 caps.