With the establishment of the General Government, administered by German authorities such as Hans Frank under the directives of the Reich, the city was subjected to a system of total control. The Jewish population was progressively isolated, confined, and deprived of resources. In 1940, the Warsaw Ghetto was established, where overcrowding, food shortages, and deportations defined daily life. Szpilman lost his family during the major operations of 1942, when most of the ghetto's inhabitants were deported to Treblinka. From then on, his survival depended on forced labor, hiding, and the help of Polish civilians on the so-called "Aryan side."
In 1944, after the Warsaw Uprising and the systematic evacuation of the city, Szpilman remained hidden among the ruins. It was there that he met Wehrmacht Captain Wilm Hosenfeld, who decided not to betray him and provided him with food and shelter during the winter. The entry of Soviet troops in January 1945 brought an end to the German occupation. In the postwar period, Szpilman resumed his musical work in Warsaw, left a written record of the city's destruction, and continued his career as a composer and cultural organizer until the end of the 20th century.