They Fought Both the Germans and the Soviets
The Polish Resistance was fighting two fronts against two armies that vastly outnumbered and outgunned them. The Molotov-Ribbentrop Pact was a non-aggression pact between the Nazis and the Soviets which divided up parts of Eastern Europe into spheres of influence. The pact stated that neither side would ally with or aid the enemy of the other party.
The Molotov-Ribbentrop Pact divided up Poland into separate spheres of influence between Germany and the Soviet Union. When Germany invaded Poland on September 1, 1939, the Soviets were quick to follow with their own invasion, on September 17, 1939. The Polish Army was focused in the West fighting the Germans and was not prepared for a second invasion in the East. This allowed the Soviets to move quickly through the territory that had been agreed upon by the Pact.
Between 1939 and 1941 the Soviet NKVD arrested and imprisoned 500,000 Poles and 65,000 of them were secretly executed. There were numerous restrictions placed upon the Poles in the territory that was occupied by the Soviets, and a Resistance movement built up almost immediately. The Soviets lost control of their occupied areas of Poland when the German army continued advancing and broke the Molotov-Ribbentrop Pact by outright attacking the Soviet Union.
The battle against the Soviets was not over for the Poles or the Polish Resistance. During the summer of 1944, the Red Army advanced and regained the territory that they had lost to the Germans. With the end of World War II, the Soviets were allowed to keep all of the Polish territories that they had been promised with the Molotov-Ribbentrop Pact. To make it up to Poland they were given the southern half of East Prussia and territories east of the Oder-Neisse line.