I was battling Ghetsis and I lost so I had to go back to the Pokemon center and heal my Pokemon. I don't know how to get back to the castle.
There is a grunt in the Pokemon League Pokemon Center who will take you there. Source: experience.
In the Pokemon centre at the Pokemon league there is a Team Plasma grunt who you can talk to, he offers to take you to Ghetsis.
This may help you //Jofly
you have to fight the elite four again, there is a grunt in the castle who will heal your Pokemon and set your "respawn" for when you lose. and dont forget to save before important battles!!