It occurred to me that Germany was extremely productive in (at least) physics in the first thirty years of the twentieth century, and especially in the period between the end of the First World War and the start of Nazi Germany when Hitler came to power. Are there any reasons to point at for this productiveness? One might expect that a country is far less productive in the sciences when it has just lost a war..
Encouraged by the kind words about my comment, I have turned it into an answer with more details and sources.
The historiography of the impact of First World War on European science contains (at least) two distinct theses that D.Aubin and C.Goldstein dub the Bourbaki thesis and the Forman thesis in . The two disagree on the impact of WWI on the pure science community (negative for the former, positive for the latter) but the two agree on one point: Germany and the rest of Europe had different conceptions of the integration of pure science in the war effort.
In Germany, it was understood from the onset that scientists were to be integrated in the war effort to the full extent of their scientific capability (with, among the most notable figures, the tragic case of Fritz Haber ). In France and apparently England (I'm much less familiar with it), whereas scientists were certainly completely integrated in the war effort, it seems that they were mostly used to perform direct computations or considered as ordinary citizens and thus drafted and sent to the frontline. Also, it seems that Germany sent a wider generational spectrum of soldiers to the front, whereas France took a more specific policy (anyone in between a small interval). To take a concrete example, the two foremost institutions of higher science education in France were at the time (and still are) the École polytechnique and the École Normale Supérieure. The first is formally a military institution, so the entire promotion was of course mobilized and sent to serve in artillery. The second had a pretty astonishing casualty rate: 60% of the class of 1910 died in the war and by 1915, out of the 195 currently mobilized students, only 50 were alive and well.
Now the two theses diverge. The Bourbaki thesis holds that this rate of casualty created a vacuum that impaired the development of French science in the 1920. Besides, the mathematicians who kept a scientific activity during the war moved towards applied science and it apparently took them some time to come back to purer science. The Forman thesis, named after , holds that the atmosphere of synergy between government and science created during the First World War I in Germany induced a spirit of science moving forward in the early 1920s (much more controversially, he also argued that the traumatic break-out induced a spirit of radical modernism in the Weimar republic which inspired pure science research, a statement that is very hard to historically substantiate). Whatever point of view is more correct, both agree that in one of the former centers of pre-war science (Paris, or more generally, France) pure science development was halted or at least deeply changed by WWI whereas in another (Göttingen, Berlin, more generally Germany) pure science development was preserved, perhaps even encouraged by WWI.
Interestingly, WWII and the Nazi regime had apparently a symmetrical impact: it destroyed the German pure science community with disastrous long lasting impact, whereas the decades immediately after the war were a golden age for pure science in France, despite the crippling defeat and occupation it had endured.
 The War of Guns and Mathematics: Mathematical Practices and Communities through World War I in France and its Western Allies, Providence, RI: American Mathematical Society, to appear.
 Paul Forman, Scientific Internationalism and the Weimar Physicists: The Ideology and Its Manipulation in Germany after World War I, Isis 64 (1973)
The truth is that Germany ways de-facto the leader in the majority of sciences from the end of XIX century. In fact, German was the language of science just like English nowadays. For example even French mathematicians recognised the importance of knowing German in order to keep finger on the state recent advances in science. I'm mentioning French for two the reasons: first, it is a country with it own, very vivid, strong and long-lasting academical traditions, second, French was a very popular choice for international communications, much more popular than nowadays.
So, answering your question, though the country had been indeed economically devastated after WWI, this has nothing to do with state of scientific research. Well, of course, economic difficulties had a big impact on all aspects of fundamental activities which traditionally are supported by governments, including scientific activities. But the truth is that scientists keep on working and their success was built on foundations which has been laid years before WWI.