Endocarditis is a rare and potentially fatal infection of the inner lining of the heart (the endocardium). It's most commonly caused by bacteria entering the blood and travelling to the heart.