You can catch Cobalion once you receive Surf from Alder. He gives it to you after you have defeated Skyla and defeated Cheren near Twist Mountain. From Route 6, you can surf to reach Mistralton Cave, which contains the Guidance Chamber where Cobalion is hiding.
First, Fly to Driftveil City and head northwest to Route 6. In your party, you will want to have a pokémon that knows Flash (you get the TM for Flash from a guy in the Narrow Street of Castelia City), a pokémon that knows Strength (you get the HM for Strength from a guy in a house in Nimbasa City), and a pokémon that knows Surf. It would also be helpful to bring a pokémon that knows False Swipe (you get the TM for that from Professor Juniper in her lab in Nuvema Town after your pokédex says that you have seen at least 25 pokémon), a pokémon that can inflict sleep or freeze, and a pokémon that knows Dig.
The Unova pokémon that can learn False Swipe are Oshawott and its evolutions, Leavanny, Karrablast, and Axew. Leavanny is a Sewaddle that evolved into Swadloon at level 20 and evolved again from happiness. Karrablast can be caught on Route 6, and Axew can be caught in the cave where you're about to look for Cobalion In fact, since Axew learns False Swipe at level 24, any Axew that you catch in Mistralton Cave might already know False Swipe.
On Route 6, go to the house where the scientists are studying the seasons. There is a narrow path on the left side of the house that leads up to the river. Surf up to the dark grass that is on the north bank of the river, then walk east and get back in the water that is east of those rocks that were blocking your path. Now you can surf east, and you will reach the entrance to Mistralton Cave.
Mistralton Cave 1F
Here in Mistralton Cave, you will need a pokémon that knows Flash if you want to see around you.
Head south and you will soon find a rock that you can push with Strength. Push it into the hole, get the Elixir hidden on the small rock, and continue east. You can fight Hiker Hugh here. He has an L33 Drilbur and an L33 Gurdurr.
East from Hiker Hugh, you find another rock that you can push. Push it into the hole and continue east. The path turns north. Continue north past Hiker to find a Hyper Potion hidden on a rock, and a Max Repel in plain sight. Then you can fight Hiker Clarke. He has an L34 Boldore.
West from Hiker Clarke, there is a stone that you can push with Strength. This will give you a shortcut to the entrance to Mistralton Cave. Be sure to get the Hyper Potion that is north from the stone that you just pushed. To the south from this stone, there is a stairway leading up.
Mistralton Cave 2F
Go south from the entrance to 2F to find a hidden Ultra Ball. Just to the north, there is another stone that you can push with Strength. Push it out of the way and get the hidden Hyper Potion just beyond it.
Head north from the first stone that you pushed, then east. When you go down the stairs, go south and up the stairs there. Get the Hard Stone at the end of the path, then go back the way that you came, going north.
There is another Strength stone here, so push it into the hole. Go west of where you see the stairs leading up, and push the other Strength stone into the hole to give yourself another shortcut.Go northeast from the first Strength stone that you pushed to find TM 80 Rock Slide. There is also a hidden PP Up in this area, and an Iron. If you go south from where you found the Iron, you can jump off of the ledge and go east across the Strength stone that you pushed. Then go up the stairs to Guidance Chamber.
You don't need Flash here.
Go west from where you entered to find a Revive. Then go back to the east. Skip the old man for a moment and go northeast to find a hidden Ultra Ball. Just north of that is a Dusk Stone.
Now talk to the old man. He will tell you of the legend of Cobalion, Virizion, and Terrakion. These legendary pokémon protected their fellow pokémon after humans started a forest fire during a war. Afterward they stopped trusting humans and hid away. However, Cobalion is hiding in this cave, and the old man says that if you can catch it, you can show it that humans and pokémon have a better relationship now.
Go north from the old man to find a Rare Candy. Just west of where you found the Rare Candy is a hidden Carbos.
Head south and push the Strength stone out of the way. To the south of it is another Strength stone that you can push out of the way to give yourself a shortcut to the exit. Now you can go west and north to Cobalion.
Tips for Catching Cobalion
Being a legendary pokémon, Cobalion has a very low catch rate. This means that you should do your best to bring Cobalion's HP down to 1 HP if possible. False Swipe makes this easy. As mentioned before, Oshawott and its evolutions, Leavanny, Karrablast, and Axew can learn False Swipe. It would also be ideal if you bring a pokémon that can inflict sleep or freeze. Less effective but also helpful are pokémon that can inflict poison, burn, or paralysis. I prefer not to use poison or burn because they will KO Cobalion eventually.
Cobalion is a Steel/Fighting pokémon. It is weak to Fire, Fighting, and Ground moves. It is immune to Poison moves. It is affected normally by Water, Electric, Psychic, and Flying moves. It is strong against Normal, Grass, Ice, Ghost, Dragon, and Steel moves. It is very strong against Bug, Rock, and Dark moves.
You meet it at level 42, so it knows Sacred Sword (a physical Fighting move that ignores stat changes), Iron Head (a physical Steel move that has a 30% chance of making the target flinch), Retaliate (a Normal physical move), and Helping Hand (which does nothing because this is not a double or triple battle).
Once you have lowered Cobalion's HP as much as you can, you should start throwing Dusk Balls at it. These can be purchased in Driftveil City from one of the Pokémart guys. If Cobalion's HP is down to 1, and if it is asleep or frozen, each Dusk Ball that you throw will have about an 8% chance of catching Cobalion. This drops to about 6% if you only paralyzed, burned, or poisoned Cobalion. If you only lowered Cobalion's HP to 1 but didn't inflict a status ailment, you only have about a 4% chance of catching it with a Dusk Ball.
If you run out of Dusk Balls, try using Ultra Balls until you've gone about 30 turns in battle, at which point you should switch to Timer Balls if you have any. Hopefully you'll catch Cobalion before then, though.
Once you catch Cobalion, you will be able to catch Virizion in Pinwheel Forest.