In this study, we define the pharmacy duty scheduling problem, which requires a subset of pharmacies to be on duty on national holidays, at weekends, and at nights, in order to be able to satisfy the emergency medicine needs. We model the pharmacy duty scheduling problem as a multiperiod p‐median problem with special side constraints, and analyze the computational complexity. We propose a Tabu Search heuristic and develop lower bound (LB) algorithms. We test the performance of mathematical models, Tabu Search heuristic, and the LBs on randomly generated instances. We analyze the current system in İzmir, the third largest city in Turkey, with a population of 3.5 million, and apply solution methods. Our results show that the proposed Tabu Search algorithm suggests improvements on the current system.