Heads, You Lose by R. L. Stine
Jessica and Ryan can't wait to use the two-headed 'joke' coin they bought from the HorrorLand gift shop. But the joke is on them. One simple toss of this coin whisks them back in time, into a world of terror...Suddenly, Jessica and Ryan are on the run from royal guards, who accuse them of beheading their prince. Unless they can avenge this prince and reunite him with his head, their own heads will be on the chopping block.