I was recommended to "drink Coke when sick" several times, and it sounded pretty peculiar to me as well, here is what I found wondering on the subject:
Severe vomiting+diarrhea cause you to loose many potential "fuel" (food) that is in your system, as well as causing dehydration.
Moreover, vomiting and diarrhea often result in electrolyte imbalance, which is more important than the sugar loss. And in this case: "Carbonated drinks, including cola, provide inadequate fluid and electrolyte replacement and cannot be recommended" (link, not the best reference though).
Coke also has many acid-like chemicals, that famously destroy your teeth. But on the positive side, these chemicals aid in dissolving phytobezoars (trapped mass in the stomach, that consists of components of indigestible plant material, such as fibers, skins and seeds, which may cause nausea and vomiting):
Coca-Cola alone is effective in gastric phytobezoar dissolution in half of the cases and, combined with additional endoscopic methods, is successful in more than 90% of them.
(resource - thanks, Oddthinking).
So, it is very much dependent on the particular condition, and hardly can be recommended in general.