However 1937 was the year in which the situation in Czechoslovakia became serious. In September 1937 Hitler began his program of eastward expansion. In November 1937 he informed his military chiefs of his intention to invade Austria and Czechoslovakia. After the annexation of Austria in March 1938 the Czechoslovaks knew that they were next in line. Hitler, Mussolini, Chamberlain, and Daladier met at Munich on September 29-30. They agreed the Munich treaty requiring the Prague government to cede to Germany all of Bohemia and Moravia with populations that were more than half German. On 15 March 1939 Bohemia and Moravia were occupied by Hitler's armies and proclaimed a protectorate of the Third Reich. Schwarz knew that as a Jew his life would be in danger if he remained in Prague until the Nazis arrived so, immediately after Bohemia and Moravia were occupied, Schwarz left Prague and returned to Slovakia where he felt more safe.
He was able to find a post in the new Slovak Technical University in Bratislava and he taught there until 1944 publishing a 64 page work Theory of Semigroups in 1943. However the Germans had taken over the whole country after May 1942 and mass executions followed. Many were sent to concentration camps and, in November 1944, Schwarz was betrayed to the SS by some local informers. He was arrested and sent him to the Oranienburg-Sachsenhausen concentration camp north-west of Berlin.
Of the total of around 200 000 prisoners who were sent to Sachsenhausen, about 100 000 died there. Many of the remainder were transferred to other camps and indeed Schwarz was transferred to Buchenwald, a camp which complemented the Sachsenhausen concentration camp. There were no gas chambers at Buchenwald but hundreds still died there through disease, starvation, assaults and executions. In April 1945, when Schwarz was near death, Buchenwald camp was liberated and his life was saved. Schwarz's two sisters did not survive the war however, one dying in the concentration camp at Auschwitz and the other in Bergen-Belsen camp.
Despite his horrific experiences during the war, Schwarz quickly began to devote his energies to rebuilding the education system in his country. In 1946 he was appointed to the Comenius University in Bratislava, then the following year he was appointed professor at the Slovak Technical University in Bratislava. He continued teaching there until he retired in 1982. He was Head of the Mathematical Institute of the Slovak Academy of Sciences from 1966 until 1987.
In  the direction of Schwarz's research towards semigroup theory is described:-
... in his dissertation Schwarz considered reducibility of polynomials over finite fields. Continuing his research, he studied arithmetic in the ring of integers in algebraic number fields. This led him to a necessity of investigating systems closed under an associative operation and the abstract theory of ideals in such systems. In short, his interest in classical algebra and number theory brought him to abstract semigroups.In addition to his work on semigroups, number theory and finite fields, Schwarz contributed to the theory of non-negative and Boolean matrices.
Schwarz organised the first International Conference on Semigroups in 1968. At this conference setting up the journal Semigroup Forum was discussed and Schwarz became an editor from Volume 1 which appeared in 1970, continuing as editor until 1982. This was not his first editorial role since he had been an editor of the Czechoslovak Mathematical Journal from 1945 and continued to edit this journal until he was nearly 80 years old. He also founded the Mathematico-Physical Journal of the Slovak Academy of Sciences in 1950 and continued as an editor of the mathematics part of the journal when it split from the physics part to become Mathematica Slovaca until 1990.
Among the many honours which were awarded to Schwarz there were memberships of the Czechoslovak Academy of Sciences in 1952 and the Slovak Academy of Sciences in 1953. He served as President of the Slovak Academy of Sciences from 1965 to 1970 and vice-president of the Czechoslovak Academy of Sciences from 1965 to 1970. Schwarz was awarded the 1980 National Prize of the Slovak Socialist Republic.
Schwarz had a fine reputation as a teacher and was very well liked by his students who appreciated the help and guidance he gave them. The authors of  write:-
Anyone who has listened to lectures by Schwarz could not fail to notice that he is an exceptionally clear expositor. That is why his lectures were so popular among students and graduate engineers. The following student saying is well known among the initiated "If you don't understand Schwarz, go and study something far from mathematics ..." ...
Article by: J J O'Connor and E F Robertson