If pericarditis is caused by an infection, you may be given an antibiotic or other medicine to treat the infection.