It's an open ended question that's set to be explored in a season 2... if it gets renewed.
It looks like Dan went back in time to Melody's time in the 1990s to just after Visser burned down, but did he? He certainly missed the opportunity to go back to his time with Melody through the portal Melody's mother was holding open. So if he's actually in the 90s, then he must have jumped through another portal leading to that time, but where's the portal? Did he actually find another one? Or is he still stuck in the Other World with Kalego?
Also, if Samuel pulled Melody through the portal, and they went through together, then where the hell did he come out on the other side? He didn't end up coming out with Melody, so where (or when) the hell is he?