The Sovient Untion attacked Poland primarily to regain territories that were ceded to Poland following a war between the two nations in 1920.
It is also speculated that Russia saw war with Germany as inevitable and intended to use territory taken from Poland as a buffer and ultimately a battlefield in the war with Germany.