Im just going to go out and say it, I dont think anyone here would say Nomura is a super good writer, when I heard DDD was going to involve time traveling I thought to myself 'oh no'
...In my opinion, Mr. Nomura
is a super good writer and this version of time travel is relatively straightforward. But back to the topic at hand:
Appearing in their KH1 forms was due to Yen Sid's magic, but as far as I understood it, Sora and Riku didn't actually travel through time. According to the logic presented in the game, they would have had to leave their bodies behind to do that, which they obviously didn't. It says in the reports that they were sent back to the islands at the point shortly before they were destroyed, but Young Xehanort says that events destined to happen cannot be changed when you travel through time. That being said, the islands were destined to fall into darkness and sleep, but Sora and Riku just took the raft and left.
I'm wondering if Yen Sid was able to use magic to recreate the conditions of the island at the time in the same way that he sent them back to the beginning bodily, and by unlocking that first sleeping keyhole they were able to enter the realm of sleep. The Robed Figure was able to become a "portal" himself by being there at the exact time the real islands fell into sleep, but they didn't necessarily use the same portal.