In this paper, we address the problem of allocating and scheduling employees for work shifts in the pharmacy sector of a private hospital. To tackle this issue, we introduce the pharmacy staff scheduling problem (PSSP) in the literature. To solve the problem, we propose a mixed-integer programming formulation that considers various aspects, such as the preferences of the managing team and employees, different employee categories, work regulations, and the hospital’s required operational levels. In addition to the base model, we present a model extension that allows for handling unplanned absences. To assess the model’s performance, we conduct extensive computational experiments using data collected from a real-world case study, as well as 516 randomly generated instances. Our results demonstrate that the proposed model is highly scalable and suitable for practical application. Approximately 98% of generated instances were solved within satisfactory computing times. In practice, the model significantly outperformed the hospital’s manual scheduling process, producing solutions for the real-life case in under 7 seconds, whereas manual solutions not only required several hours to be generated but also tended to produce results that were unsatisfactory in terms of both management and employee satisfaction. Moreover, manual schedules sometimes failed to meet all the problem’s constraints. It is noteworthy that the hospital administration has adopted the proposed model. Since its adoption, the hospital has reported an average improvement of 41% in request fulfillment and an average reduction of 23% in pharmacy service time, positively impacting the quality of service provided to internal customers.