What kind of pills or treatment can somebody get for endocarditis?

No pills. Endocarditis is a severe infection in the heart that needs urgent treatment with medications by vein in a hospital setting where you can be monitored very closely. Now, if you have some types of heart defects and want to "prevent" endocarditis, then under some circumstances you will need to take antibiotics by mouth (or vein) an hour before some types of medical procedures.
Antibiotics/surgery. Endocarditis is an infection inside the heart. It can affect the heart valves or muscles. Certain infections can be cured with antibiotics, certain require surgery. Endocarditis can be a life-threatening condition.