Dentists or dental professionals prescribe medications depending on the condition – certain medicines are prescribed to prevent or treat infection, reduce pain and inflammation, relieve anxiety, teeth cleaning and whitening or bacterial infection treatment and more.