Can a pharmacist get fired if they refuse to give certain kinds of medications to their patients?

Yes. Pharmacist gets a university level education learning about the medications, their indications, interactions, toxicities- all about them. Their duty is to check for allergies, dose of medications, any interactions they may have with other meds-- alert the physician concerned about any of these issues. Anyone in medical field or in other jobs can get fired if they are not responsible.