With the Soviet annexation of Estonia in 1940, Hugo Treffner Primary School was closed, and Hugo Treffner Progymnasium, Hugo Treffner Secondary Sciences School and Hugo Treffner Gymnasium were merged into Tartu Secondary School No. 4. Johannes Valgma was appointed the new director. During the German occupation of 1941–1944, this school was closed and on 2 January 1942, Hugo Treffner Gymnasium was reopened, under the leadership of August Raielo. The school was situated in the building of the Tartu Secondary School No. 1.