Trimethoprim is an antibiotic that fights bacteria in the body. Trimethoprim is used to treat bladder or kidney infections, or ear