Göttingen was the place in which many important mathematicians such as Riemann worked. It was also one of the main locations for the development of quantum theory in the twenties (e.g. Heisenberg, Born worked there) What led to its decline, was it previously building up to it or was WW2 the only cause? Also when did it occur?
It's not exactly the war, but the Nazi regime more generally that caused the decline of Göttingen. When the Nazis came to power in 1933, they started implementing antisemitic measures quite quickly. An important step in the Nazi policy was what is now dubbed 'the great purge of 1933', which (basically) aimed to expel all Jews from positions in government or academics.
The 'purge' caused a huge amount of influential scientists to leave Göttingen, mostly involuntarily (fired or fled the country), including Born, Noether, Wigner, von Neumann, Franck and many others. Born was even officially stripped of his PhD. degree. This turned out to be a decisive blow (something which applies more generally to science in Germany, which was really unrivaled in the early 20th century): The university never quite regained its former glory. One very telling example is given in this book. Between 1931 and 1939, the number of mathematics students in Germany declined from over 7000 to around 1250. The link that I provided to the Historical Encyclopedia of Natural and Mathematical Sciences also contains a very 'nice' anecdote, illustrating the damage that was done:
In 1934, David Hilbert was sitting next to the Nazis' newly appointed minister of education, at a banquet. When asked, "And how is mathematics in Göttingen, now that it has been freed of the Jewish influence?" Hilbert replied: "Mathematics in Göttingen, there is really no such thing any more."
It's worth noting that we can't just pin it down to "The Nazi regime" and we may have to just say "The Nazis." Take for instance the case of Landau. He could not be purged as such but when he tried to teach in Fall 1933 he faced a student boycott led by Oswald Teichmuller. A letter from Landau sets the scene.
On 2 November, about 11.15, as I wished to leave my office and go to the large lecture theatre to begin my lecture, the entrance hall was filled with about 80 to 100 students who let me pass through unhindered. In the lecture hall was one person. Clearly therefore, there was a boycott with sentries at the door who had prevented (without force) those students who wanted to work from setting foot in the lecture room.
What happened - and it happened with the collaboration of many who were my pupils - leads me to believe that the only consequence must be my application to become emeritus or pensioned.
The article notes that it's reasonable to assume the boycott was actually organized by the SA but given his later history, it seems likely that Teichmuller was perfectly happy to be the face of the boycott. He was a staunch Nazi who frequently published in Deutsche Mathematik and indeed met his end fighting on the Eastern front after the German defeat at Stalingrad. Much more on this and similar topics can be found in "Mathematicians under the Nazis" by Segal.
MacLane's article "Mathematics at Göttingen under the Nazis" is a very vivid first hand account of the time 1931-33. MacLane writes:
... in 1933 eighteen mathematicians left or were driven out from the faculty at the Mathematical Institute in Göttingen
which shows how quickly the department disintegrated after the Nazis came to power.