Dortmund revealed the news on their Facebook page and Bayern have also released a statement.
"Bayern Munich confirm that the club have reached an agreement with national team player Mario Goetze that he will play for Bayern Munich from 1 July 2013," it read.
"Bayern are prepared to meet the release clause agreed between Borussia Dortmund and Mario Goetze."
Borussia chief executive Hans-Joachim Watzke admitted he would be sorry to see Goetze go but admitted the player had not broken his contract to secure the move.
"We are obviously disappointed beyond measure, but emphasise that both Mario and his advisers have behaved within the terms of the contract," he said.
The timing of the announcement is unhelpful for Dortmund, who face Real Madrid at the Westfalenstadion in the first leg of their Champions League semi-final on Wednesday.
Borussia have urged fans to get behind Goetze and the rest of the team though, as they look to secure a place in the Wembley final against Bayern or Barcelona.
The statement added: "Coach Jurgen Klopp and sporting director Michael Zorc ask all fans of Borussia Dortmund to support Mario Goetze unconditionally as they would any other player in the final games of the season, but especially in the important Champions League semi-final against Real Madrid."
Klopp's side recently lost the Bundesliga crown they won in each of the past two seasons, with Bayern claiming the title in record time.