The FDA (and other government agencies around the world) have strict regulations that the pharmaceutical companies have to follow, and sometimes this causes what would appear to be contradictions between the benefits of the medicine and its side-effects.
When a drug is going through the process of being certified as a medicine, there are several stages of testing that the drugs must undergo. Before a drug even gets tested in human population, it must first pass pre-clinical trials, usually by testing on laboratory animals. If the drug is too harmful in relation to the harm of the disease, then it is discontinued through the rest of clinical trials.
If a drug passes pre-clinical trials, then it goes through phase 1 clinical trials, which tests the toxicity of the drug. It looks to see whether the "efficacy window" (the dosage where the drug is effective) lies in a safe area of drug effects; if the drug's efficacy window is too close to it's toxicity levels (eg the amount to take in order to elicit an effect is too close to the amount that causes worse side-effects such that the likelihood of accidental overdose is great) the drug is again dropped from clinical trials.
After passing phase 1 clinical trials, it goes to phase 2 which tests the efficacy of the drug. This tests more whether the drug is acting the way that it was designed to work. If the drug is to be used to treat a disease, the phase 2 trials tests whether the drug actually does show a statistically significant improvement of the disease. This is also where they start analyzing the efficacy window to determine the best dosage to have an effect without being too high to cause any undo side-effects.
Finally phase 3 clinical trials tests how the drug compares with the current standard of treatment. This tests whether the drug is more effective than the standard treatment, has less harmful side-effects, and / or targets the disease in a novel way that may work better under certain situations. If the drug isn't any better (or at least as good) in any way than the current standard of treatment, the drug is dropped.
During this entire process, the FDA requires drug companies to monitor and report on any possible side-effects of the drug. Some side-effects are expected because of the mechanism of action of the drug. For example many anti-cancer agents have hair-loss, increased chance of infection, and nausea as possible side-effects because the drug targets quickly multiplying cells like those found in tumors, hair follicles, immune cells, and intestinal lining. However, if one patient reports nausea from taking the drug, the pharmaceutical company has to report nausea as a possible side-effect, even if they cannot determine a causal relationship between the drug and the side-effect. So sometimes the so-called possible side-effect is actually just a false-positive for that effect (eg the person with nausea may have just suffered from food poisoning and not an actual side-effect of the drug). This is why those drug commercials seem to have such a long list of possible side-effects. Additionally, sometimes the side-effects seem severe, but when compared with doing nothing, the progression of the disease is worse than the side-effect. For example, even though some meds for the treatment of depression lists increased suicidal tendencies, not using the medication has an even higher risk of suicide or even homicide, so although the side-effect is very severe, it isn't as bad as doing nothing to treat the person's depression.
And don't fall for the "all natural is better" fallacy. The chemical molecules are no different whether man-made or naturally made; a water molecule will always be 2 hydrogen atoms bound to an oxygen atom regardless of whether the water molecule was created in a lab or as a natural byproduct of respiration. However a molecule was created, it is its effect on the body that determine whether a molecule is "good" or "bad". Many natural molecules cause disease and / or some harmful effect, while many man-made molecules are beneficial for humans. However with natural products, we have a long history of its use that acts like these clinical trials, whereas the drugs created by pharmaceutical companies don't have this usage data yet, thus the requirement for them to undergo additional clinical trials. This is why it appears that pharmaceuticals have more (or more severe) side-effects than their natural counterparts; the natural product may have just as many side-effects and may be just as bad as a man-made drug but because they don't have to go through as extensive of a testing process nor do they need to report those side-effects, it only appears that natural products are better than pharmaceuticals. But by the same token, those drugs are tested for a specific disease (or preventative) and so can make claims like it is used in the treatment of UTIs. Natural products on the other hand haven't been tested for a specific disease; this is why ads for natural "cures" or "treatments" usually have the disclaimer that "This product is not intended to diagnose, treat, cure, or prevent any disease." as they haven't undergone the rigorous testing required to certify that statement.