From the Super Mario Wiki
Magic Potions are items that Mario and his friends discover in the land of Subcon during the events of Super Mario Bros. 2. They replaced the Magic Lamps from Yume Kojo: Doki Doki Panic.
Super Mario series
Super Mario Bros. 2
In Super Mario Bros. 2, when picked up and thrown to the ground, a Magic Potion allows Mario and friends to enter Subspace, where they can find Gold Coins and Mushrooms. In certain areas throwing one on to a Vase will create a door that will act as a Warp Zone and allow Mario to warp to a different World. In Super Mario Advance, after finishing the game, one can find Yoshi Eggs.
BS Super Mario USA
In the sequel, BS Super Mario USA, the Magic Potions are necessary to find Wart in one of Subspace's Vases as he were always hidden in these dimensions.
The Super Mario Bros. Super Show!
In The Super Mario Bros. Super Show!, King Koopa sometimes pulls out a Magic Potion at the end of an episode, usually when he is outmatched by Mario's group, in episodes such as "Bad Rap" and "Mario Meets Koop-zilla" and throws it, creating a Warp Zone for him to escape.
The magic potion has made a brief appearance in Super Mario-Kun in volume 8. Here, Luigi attempts to give it to Mario to aid him in defeating Tryclyde.
Toad has also used the Magic Potion in a fight with Wart. He enters the door the potion creates and then gives powerups to aid Mario, Luigi, and Yoshi during the fight, including Super Leaves, P-Wings, and Frog Suits.
Names in other languages