After arriving in Sootopolis City, you meet Steven, Wallace, and the leaders of Team Magma and Team Aqua, who tell you to go to the Cave of Origin.
Go to the Bottom of the Cave
Go north to enter the first big room of the cave. Use the Dowsing Machine there to find a hidden X Attack to the right of the entrance.
Then go counter-clockwise to the next room. Use the Dowsing Machine there to find a hidden Revive just east of the entrance.
The rest of the cave is straightforward. Make your way to the bottom of the cave. At the bottom, in Omega Ruby, you find Magma, and in Alpha Sapphire, you find water. Walk up to it and watch the cut scene.
After the scene, your PokéNav Plus will not be able to display anything, but you can still save the game. So save the game now, then do whatever you need to do to prepare for the encounter with Groudon/Kyogre. When you're ready, go up and check on the legendary pokémon. Watch the cut scene, and then the battle will begin.
If you're not ready, you can go to west and through the door to go back up to the exit.
Groudon knows Precipice Blades, Earthquake, Rest, and Lava Plume. Precipice Blades and Earthquake are Ground-type attacks, and Lava Plume is a Fire attack. Rest will cause Groudon to fall asleep and heal some of its HP.
Kyogre knows Ice Beam, Origin Pulse, Aqua Ring, and Body Slam. Ice Beam is an Ice-type attack, so don't bring pokémon that are weak to Ice, such as Grass-types and Flying-types. Origin Pulse is a Water attack, and Body Slam is a Normal attack. Aqua Ring is a move that restores a small amount of HP every turn.
After the battle, watch the cut scene. You will receive the other Orb. Give the Orb to the legendary pokémon and it will revert to its Primal form in battle.
Steven gives you the Eon Flute. You can use the Eon Flute to soar through the sky. This opens up many new areas to you. You can use it any time to summon Latios (in Omega Ruby) or Latias (in Alpha Sapphire), even if you don't have that pokémon in your party.
You can fly to Littleroot Town and talk to Professor Birch to get the National Pokédex. Many new pokémon have appeared around Hoenn now that the legendary pokémon restored the balance of nature.
When you are ready, you can go into the Sootopolis Gym.