Twisted intestines, or Bloat (The name for this condition) is pretty common in dogs. Bloat can happen for a number of reasons and when a dog has bloat the intestines can become twisted and this is very dangerous and can kill a dog very quickly. Thankfully you caught this in time!
The cause of this condition is varied. Though the most common cause in puppies is eating to much to fast and thus ingesting air. It can also be caused by Stress, Activities that result in the dog "gulping" a lot of air, eating foods that cause gas, exercise before and after eating, drinking water very fast (Again getting to much air in).
Here is a great site about the condition. It will list all the ways a dog can get Bloat, and how to prevent it in the future as well as the symptoms of what to watch out for. Unfortunately a dog that has had bloat once, tends to be more susceptible to it again in the future so please take a moment and read up on how to prevent it and what to watch for.
Please Click Here For More Information