URL of this page: //medlineplus.gov/ency/article/001098.htm. Endocarditis is inflammation of the inside lining of the heart chambers and heart valves (endocardium). It is caused by a bacterial or, rarely a fungal infection. Endocarditis can involve the heart muscle, heart valves, or lining of the heart. Some people who develop endocarditis have a: Birth defect of the heart.