As I recall, when Link went to the CT he still had his triforce piece with him that he got from the AT. I believe the Hyrule Historia explains that his having the Triforce of Courage triggered in a reaction within the Sacred Realm, releasing the other two triforce pieces. That's how Zelda got...