It comes from Star Trek (originally a TV series, then several movies). Scotty was the character in charge of transportation - instant teleportation from one place to another. They used to say 'beam me up Scotty' as an instruction to start teleporting them.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
Though it has become irrevocably associated with the series and movies, the exact phrase was never actually spoken in any Star Trek television episode or film.(Wikipedia)