Benatia, brought in to replace the injured Javi Martinez, who is out for the rest of the year, joined Roma in 2013 after three seasons at Udinese, and cost 25 million euros (£19.9 million), according to media reports.
"When you get an offer from Bayern then you cannot really say no," said the defender, who will meet up again with Frenchman Franck Ribery, with whom he had played at Olympique Marseille from 2005-2007.
"This is a great chance for me and I will be playing for one of the greatest clubs in the world."
The 27-year-old France-born Benatia formed a strong partnership with Brazilian Leandro Castan last season, helping his side to a second-place finish in Serie A.
The Moroccan, who has 31 caps, became unsettled, however, publicly accusing the Italian club of breaking promises regarding a salary increase.
Spain international Martinez tore cruciate ligaments in Bayern's Super Cup defeat by Borussia Dortmund earlier this month and will be out for at least six months, forcing coach Pep Guardiola to bring in a replacement.
- Sports & Recreation
- Javi Martinez
- Franck Ribery
- Olympique Marseille