Germany and the Soviet Union had signed a non-aggression pact in 1939 almost immediately before Hitler attacked Poland. There was also a secret clause that stated, in exchange for Stalin giving Hitler a free hand, the Soviets could take eastern Poland, the Baltic States, and part of Romania for themselves.
Once the Red Army occupied their section of Poland, Stalin wanted to wipe out the officer corps of the Polish Army, so that there would be no leadership for any kind of resistance movement. Those officers that were not captured were arrested, and once collected, driven in the Katyn Forest and executed.
There were almost 22,000 estimated murders in all, but this included members of Poland's educated, intellectual class as well. Doctors, lawyers, university professors were rounded up and killed right after the officer corps had been murdered. Stalin expected Poland would cease to exist, and had these people killed so that there could be no organized citizen resistance, and so that Poles would be much easier to make subservient to the Soviet state.