You can cast a spell using beam me up even if it was somehow put into your graveyard without having been cast.

Artwork
Loading artwork…
Pure Energy
Star Trek · #31 · EN
Nonfoil—Foil—
Card rules
Distribute two +1/+1 counters among one or two target creatures.
Beam me up 2
(You may cast this card from your graveyard for 2
if you also return a creature you control to its owner's hand. Then exile this spell.)
So advanced in thought and being, the Organians have no need for corporeal form.
Common · Illustrated by Evan Shipard
Format legality
Brawl Legal
Commander Legal
Competitive Brawl Legal
Duel Legal
Future Legal
Gladiator Legal
Historic Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Pauper Legal
Pauper Commander Legal
Penny Legal
Pioneer Legal
Standard Legal
Standard Brawl Legal
Timeless Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Old School Not Legal
PreDH Not Legal
Premodern Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
If you choose two targets for Pure Energy, and only one of the creatures remains a legal target as the spell tries to resolve, the original distribution of counters applies and the counter that would have been put on the illegal target is lost. It won't be put on the remaining legal target.
You choose the number of targets and how the counters will be distributed as you cast Pure Energy. Each target must receive at least one counter.
If a card with beam me up is put into your graveyard during your turn, you can cast it if it's legal to do so before any other player can take any actions.
You must still follow any timing restrictions and permissions, including those based on the card's type. For instance, you can cast a sorcery using beam me up only when you could normally cast a sorcery.
"Beam me up [cost]" means "You may cast this card from your graveyard by paying [cost] and returning a creature you control to its owner's hand rather than paying its mana cost" and "If the beam me up cost was paid, exile this card instead of putting it anywhere else any time it would leave the stack."
A spell cast using beam me up will always be exiled afterward, whether it resolves, is countered, or leaves the stack in some other way.
To determine the total cost of a spell, start with the mana cost or alternative cost (such as a beam me up cost) you're paying, add any cost increases, then apply any cost reductions. The mana value of the spell is determined only by its mana cost, no matter what the total cost to cast the spell was.