When Poland was created at the end of WWI it had been made up of former German and Russian territories
Both Germany and Russia despised the new state of Poland and the USSR had immediately started questioning its existence
Stalin was determined to reclaim this land and Hitler was concerned about what Stalin would do if the Germans invaded
Hitler couldn't not risk Stalin intervening, so he sent his foreign minister, Joachim von Ribbentrop, to make a deal. If the USSR allowed Hitler to invade Poland, the USSR would be given Polish territory
On 23rd August 1939 a non-aggression pact was signed, called the Nazi-Soviet Pact