Media playback is not supported on this device
Gotze, 24, made 83 Bundesliga appearances for Dortmund before joining Bayern Munich in 2013.
The size of the deal is unknown, although reports have suggested it is in the region of £20m.
"I have since his departure in 2013, always hoped that he will one day return to us," Dortmund CEO Hans-Joachim Watzke told the club website.
Gotze helped Bayern to three Bundesliga titles, as well as scoring Germany's winning goal at the 2014 World Cup.
His move to Bayern for a reported 37m euros (£31.5m) was the most expensive German transfer at the time.
Find all the latest football transfers on our dedicated page.

The militants targeted villages under government control, and clashed with the army and its militia allies.
The UK-based Syrian Observatory for Human Rights (SOHR) said at least 15 of the dead were civilians.
The fighting is near a strategically important highway linking Hama city with the Aleppo area further north.
The SOHR said at least 27 government troops or militia were killed in the attack, on the villages of Aqareb and al-Mabujeh. Another 10 bodies had yet to be identified.
Some of the civilians killed were put to death after being captured by IS, the observatory added.
State news agency Sana also reported the attack in Aqareb, saying 20 civilians were killed there, but made no mention of al-Mabujeh.
Why is there a war in Syria?
IS was now fully in control of Aqareb, SOHR said, adding that the government had sent reinforcements to the area.
Hama province is divided three ways between government forces, rebels and IS, with the militants mainly occupying the eastern part.

The 25-year-old, who finished last season on loan at Northampton, has agreed a three-year deal with the Reds.
Collins is Crawley's 12th signing of the summer transfer window.
"James wants a new challenge and he comes with a very good goalscoring record in League Two," Reds boss Dermot Drummy told the club website.
Collins, who has previously had spells at Aston Villa, Swindon and Hibernian, scored 15 goals in 49 appearances last season.
Find all the latest football transfers on our dedicated page.

Some 853,000 16- to 24-year-olds were NEET at the end of 2015, down 110,000 on the same quarter of 2014.
But the figures also show the numbers were 5,000 higher than in the summer.
City and Guilds managing director Kirstie Donnelly said it was "worrying" to see the figures "creep up after months of more positive news".
The Office of National Statistics figures date back to October to December 2001 when 833,000 young people were classified as NEET, some 12.9% of the total age-group.
At the end of last year that proportion had fallen to 11.8%.
NEET numbers reached from highs of over a million, or more than 16% of the age-group, in 2011, but have fallen consistently since.
In England, the government raised the education participation age to 17 in September 2013 and to 18 in September 2015.
So young people in England are now expected to stay in full-time education, in an apprenticeship, or in employment with training until they are 18.
The UK-wide NEET figures first dropped below the million mark, to 987,000, or 13.5% of the age group in the first quarter of 2014.
England-only figures show there were 690,000 NEETs at the end of last year, almost 100,000 fewer than in the last quarter of 2014.
This figure is the lowest since 2000 when comparable records began and the number stood at 629,000, says the government.
Skills Minister Nick Boles said the figures showed the government was delivering on its commitment to ensure all young people were either earning or learning.
"There is no room for complacency, though, and through our plans to deliver three million new apprenticeships by 2020 and our qualification reforms, we are determined to build on these excellent results," said Mr Boles.
But campaigners say the figures are still too high
"More than one in every 10 teenagers is currently locked out of a path to the future," said Ms Donnelly.
And Jenny North, policy and strategy director of Impetus PEF, which funds projects to help the most disadvantaged young people, called for more government action.
"We need to see a clear focus from government on how they will help disadvantaged young people succeed in education, and progress into sustained employment so they can fulfil their potential," said Ms North.
Borussia Dortmund have re-signed forward Mario Gotze on a four-year deal, subject to a medical.
[NEXT_CONCEPT]
More than 50 people are reported to have been killed in heavy fighting in Syria after so-called Islamic State launched an attack in Hama province.
[NEXT_CONCEPT]
League Two side Crawley Town have signed James Collins after the striker's contract at Shrewsbury Town was cancelled by mutual consent.
[NEXT_CONCEPT]
The number of young people not in education, employment or training (NEET) is at its lowest for the time of year since 2001, UK-wide figures show.