The 27-year-old Morocco international had reportedly been a target for both Arsenal and Manchester United after excelling at the Stadio Olimpico to help Roma finish second in the Serie A table last season.
But Bundesliga giants Bayern have now secured his services for the next five years.
A statement published on the club's official website read: "On Tuesday afternoon the German champions reached an agreement with Roma over the transfer of Mehdi Benatia.
"Both clubs have agreed not to disclose the transfer fee.
"Benatia will come to Munich in the next few days to undergo a medical. The central defender will then sign a five-year contract."