If we didn't purchase Alaska, the Soviet Union would have had a foothold in North America..
Actual sequence of events
1. Russia sees it can't hold Alaska with the Spanish, the Brits, and the Americans coming closer every day. The Brits were already in Alaska.
2. Russia decides to unload the territory where it will do the least harm, and America is getting closer every day in spite of their internal war and might simply take Alaska for free.
3. Russia chooses to sell to America, as the Brits and the Spanish are all competing with Russia on the Euro continent and are a more immediate danger. America is a danger, too, but not immediate; besides America is at war with itself at the moment and has the cash due to French, Brit, and Spanish war investment.