Prevention of pericarditis involves addressing underlying risk factors. This includes prompt treatment of infections, managing chronic diseases effectively, and avoiding injury to the chest. For those with recurrent pericarditis, long-term medication such as colchicine may be recommended to prevent further episodes.