Some can be used to treat several different health conditions. Aspirin, for example, can be used to treat pain, inflammation, and fever. In addition, aspirin can prevent heart attacks if taken on a regular basis. The following information is a basic overview of how some drugs work to improve your health. Fighting Infections. An infection occurs when microorganisms, such as bacteria or viruses, invade your body. Medications used to treat infections can kill germs directly or prevent them from multiplying and growing.