During World War II, he was imprisoned at the concentration camps in France from which he was deported for forced labour to Nazi Germany. He managed to escape in mid-July 1941, and move to the occupied territory of Yugoslavia, in Croatia. Upon arrival, Štajnberger briefly stayed in Zagreb, and then moved to the liberated territory in Kordun. He helped organize the first Partisan units in Perjasica, Kestenjac, Veljun, Kloloć and Kladuša. Among the Partisans and the people of Kordun at the time, he was known by his birth name Adolf.