The plug on the tanning bed is a 6-20P plug (250V 20 Amp), but the receptacle is a 10-30R (125/250V 30 Amp), so they aren't quite the same. The tanning bed expects 2 hots and a ground wire, but the outlet provides 2 hots and a neutral (which is almost, but not quite the same)
The "correct" way to do this would be to replace the dryer plug with a properly grounded 6-20R receptacle and replace the 30 Amp breaker in the panel with a 20 Amp. The only difficulty may be in finding a code compliant way to hook up the ground terminal of the 6-20R using existing wiring.
If the existing shared neutral/ground wire is bare or green, then you can use that as-is, just make sure that it's connected to the grounding busbar in the panel. (a main panel may have shared ground/neutral busbar(s), a subpanel will have separate busbars for ground and neutral and it is important for safety to terminate grounding conductors on the correct busbar). If the existing neutral wire is not already a green insulated or bare copper wire, you cannot re-use this wire as a ground even if you mark the wire as such. If the wires go through continuous metal conduit back to the panel, you may be able to use the conduit as ground through a self-grounding receptacle in the metal box, or a ground jumper from the conduit/box to the receptacle.
Once you have a grounded 6-20R receptacle to plug into, you can use an off-the-shelf 6-20R extension cord to extend it.
For something like a tanning bed where people (likely with damp sweaty skin) will definitely be in contact with it, I wouldn't cut corners on grounding and do it the right way.
There are 6-20R to 10-30R adapters available, but they are not safe or technically legal