It was actually comedian Tina Fey, who was impersonating Ms. Palin on Saturday Night Live, who uttered the line that is now widely attributed to the former Alaska governor.
The basis for this line comes from a September 2008 interview with ABC News's Charles Gibson, who asked Palin what insights she had from her state being so close to Russia. She responded: "They're our next-door neighbors, and you can actually see Russia from land here in Alaska, from an island in Alaska."
This is true. As Slate has pointed out, on a clear day, those on the Alaskan island of Little Diomede can see the Russian island of Big Diomede, located across the International Date Line some two and a half miles away. Given that Big Diomede has no permanent population, the amount of foreign policy experience one can gain from staring at it is debatable. But you can see Russian soil while standing in Alaska.