Endocarditis, or infective endocarditis, occurs when the inner lining of the heart (the endocardium) or the heart’s valves become infected by bacteria or other germs. The bacteria that cause endocarditis typically spread through the bloodstream from the mouth, from infected foreign bodies such as needles, or from another part of the body to the heart.