Before the USSR joined the allies, they signed a non-aggression pact with Nazi Germany. As part of that pact, they also agreed to jointly invade and occupy Poland, spreading their respective sphere of influence.
Yes they USSR did eventually join the ally cause, but only after getting stabbed in the back by the Nazis. The Nazi were now the enemy of both the allies and the USSR. The enemy of my enemy is my friend, even if only temporary.
I loved his book Ghost in the Wires. Read it after he appeared on The Colbert Report years ago.