You battle it again,Of course!
It behaves like Resiram and Zekrom in Pokemon Black and White.You have to catch it to continue the story.You won't get any EXP if you defeated it.If you did,it will act like nothing had happened and you are free to roam.However,like I've just said,you have to catch it.
Fortunately,Gamefreak was kind enough to increase Rayquaza's catch rate so that it would be easier for us to catch it.
Little edit to confirm free roam even without all your Pokemon being fainted:
http://www.youtube.com/watch?v=rvF6nC91Brc
Skip to 8:29
You will see the player being able to move even if he accidentally defeated Rayquaza