Pennsylvania Code Title 48, Section 27.18(c) states the following:
(c) A pharmacist may decline to fill or refill a prescription if the pharmacist knows or has reason to know that it is false, fraudulent or unlawful, or that it is tendered by a patient served by a public or private third-party payor who will not reimburse the pharmacist for that prescription. A pharmacist may not knowingly fill or refill a prescription for a controlled substance or nonproprietary drug or device if the pharmacist knows or has reason to know it is for use by a person other than the one for whom the prescription was written, or will be otherwise diverted, abused or misused. In addition, a pharmacist may decline to fill or refill a prescription if, in the pharmacist’s professional judgment exercised in the interest of the safety of the patient, the pharmacist believes the prescription should not be filled or refilled. The pharmacist shall explain the decision to the patient. If necessary the pharmacist shall attempt to discuss the decision with the prescriber.
Without more information, I can't comment on precisely why the pharmacist declined to fill the prescription; however, the pharmacist is obligated to explain why he or she declined to fill it and should attempt to speak with your physician about the issue.
I recommend you ask the pharmacist for an explanation, and if he or she won't provide an answer, ask to speak with his or her supervisor or the pharmacist-in-charge. If that doesn't produce results, write a letter to the pharmacy addressed to the pharmacist-in-charge asking for an explanation. If you still aren't satisfied, you can file a complaint with the Pennsylvania State Board of Pharmacy (http://www.dos.state.pa.us/portal/server.pt/community/state_board_of_pharmacy/12519/consumer_information/572073).
The short answer is "yes." A pharmacist may refuse to fill a prescription if they feel it is illegal, medically inappropriate, or you are "drug seeking" (see the previous, fairly comprehensive answer for details of the statute and regulations). He or she may also refuse to fill a prescription based upon their own moral code (ex. oral contraceptives), but must then refer you to a pharmacist who will fill it.
There are many more facts needed before your question can be answered correctly, and I agree that you should inquire as to the reason for the refusal, but the easier approach is to simply take the prescription to another pharmacist.