Assuming you're playing as Roxas, make your way to the haunted mansion and head through the lab. Battle Axel, then continue through the doors into a corridor lined with pods where you can see Donald and Goofy. Go through the door at the end for a cutscene, and you'll merge with Sora—after which you take control of him.