Hobies are actually very stable when you are flying them. If it begins to go too far you can let the main sheet out or just lean harder. Preferably lean harder as that will make you go faster.
Hobie Cats and (I think) Aqua Cats, have masts that are designed to float. Hobie also makes a little ball that you can mount on top of your mast to keep it afloat even more if it goes over. If it turtles, or goes completely upside down (because the mast got a hole in it somehow and you dont have an extra float) then you are pretty much SOL. Otherwise you turn the boat to where the mast is 45 degrees off of the wind. You tie a rope to the lower side of the trampoline and throw it over the pontune that is up in the air. Then you and your buddy (or just you if sailing alone) grab on to the rope, stand agianst the bottom of the boat and lean hard. All you have to do is get the mast about 6" over the waves and the wind will catch the sail and flip the boat back over.
here is an illistration
Mono Hulls will heel and often flip as well. Their masts are also designed to float (usually) and in that case you just climb onto the keel and pull on the edge of the boat with the sail in the same direction.
Agian, if it turtles you are pretty SOL. You have to dive down and take off the Jib (front sail) and bring the main sail almost completely down and let the main sheet loose (the main sheet is the rope that controlls the main sail). You then tie a rope to one of the pontunes and stand on the other and lean and pull. It is a long, slow process. If you are alone and arent hefty then you may as well wait for a boat with a motor to come and help you because you arent going to be able to right it alone. If you are a good free diver you might be able to retrieve some rocks from the bottom, bring4 or 5 to the surface and then attach one of your life jackets to it then dive back down and tie the life jacket to the mast then untie the rocks. I havent tried it and dont know if it would work; If it happened to me that is the first thing I would try unless I was in 60-70ft + Water.