Healthcare professionals "buy" malpractice insurance
by paying premiums for it, just like health insurance, automobile insurance, or homeowner's insurance. Since hospitals also buy malpractice insurance, many of the people who work for the hospital are covered under the hospital's insurance policy, and don't need to buy their own coverage. But that varies from facility to facility, and would need to be discussed in detail when you were applying for a job.
If (God forbid!) you get sued for malpractice, your insurance company provides legal representation and pays any award or settlement that results, the same as your automobile insurance company does if you're in at fault in an automobile accident.
Is all of this starting to make sense?