After the outbreak of World War II, Ehrlich made his way to the part of Poland that had come under Soviet control. He was arrested by the NKVD in Brest on 4 October 1939. On 2 August 1940, in Saratov, he was sentenced to death, but the sentence was later commuted to ten years in the Gulag. After the June 1941 German invasion of the Soviet Union, he was released in 1942 as part of the Sikorski–Mayski Agreement of 30 July 1941 between the Polish Government in Exile and the Soviet Union. He was asked to join the newly formed Jewish Anti-Fascist Committee, headed by Solomon Mikhoels.