I'm not sure Sora did Time Travel. He goes to the Final World, but he has a form there & isn't just a heart, & is body is there, because Kairi is fighting with all her strength to hold him together.
Namine's dialogue also suggests his TFW form is because of Kairi, which'd make SOME sense, IMHO given Kairi restored Sora from his Heartless form in KH1.
We also learn Namine was the one who contacted Terra, so if time is only going forward, there's still a reason Lingering Will would've shown up, as opposed to going back in time before she contacts him, in which case, why didn't he show up the first time? Going purely forwards in time at least provides an answer: Terra/Lingering Will wasn't aware he was needed, or Namine's contact helped him gain some use of LW again.
Anyway, after piecing himself back together, Sora went & got his friends' hearts, & going by his dialogue with Chirithy about how to rescue them, the YX & his final fate, we can assume Sora revived his friends using the Power of Waking.
Also, when Sora comes back, we can see his friends all grouped to greet him. Why would they be expecting him to show up there & now if he had time travelled?
Goofy even says
"Now point us back at those guys!" A Goofy from the past wouldn't say "back" because Past Goofy wouldn't have fought the Seekers of Darkness to begin with.
Not only that, when Sora arrives in TFW, Chirithy tells him no one else arrived with him, & so they're gone forever, or clinging to the world he came from. Given Sora uses the Power of Awakening on their Hearts & the Hearts go away, & his reaction, Sora probably sent them back to their bodies.
TL;DR - It doesn't seem like time travel, but that Kairi fought to hold Sora together, Namine contacted Terra, & Sora was able to have the atypical boon of his body being in the Final World for him to piece back together. He did, then used the Power of Waking a lot to get his friends back, & they all went to The Keyblade Graveyard for a second time.