Link bif his farewells to Zelda after the events of Ocarina of Time in order to search for Navi.
He was ambushed by the Masked Skullkid who stole the Ocarina of Time and Epona, and so Link simply followed and chased him, ending up falling through the portal to Termina. Link followed Skullkid to Termina. He was never transported there - that never happened
at all.
And at the end of the game, after Link had destroyed the evil in the Mask and handed it back to the Mask Salesman, he took Epona and went back to the woods to continue searching for Navi.
The Link in
MM is not the same Link as
TP Link.
TP takes place centuries after
OoT, and furthermore, the Hero's Shade in the game is Link the Hero of Time's lingering sentiment (
TP Link himself is one of many incarnations of the original hero Spirit).
There is a single, linear progression from
OoT's CT to
TP. The only single deviation (if you choose to see it as such) is when Link traveled Termina and then back again.