There is no law regarding this type of situation, at least not one I am aware of. The resolution of this situation would entirely depend on what the pharmacy decides to do. In general, pharmacies serve their patients on a first come, first serve basis.
It's pretty uncommon that four people would go to the pharmacy all at the same time for the same medication. If that did occur, however, there are a few different options I could see as reasonable.
Most commonly, I would think that the pharmacy would provide a complete fill of medication to as many patients as they could (usually in the order they dropped off their prescription).
At the point in which there is not enough stock to completely fill a prescription, they would partially fill it.
New York State law stipulates that pharmacies can provide a partial fill of a medication provided that the completion of that fill will occur within 72 hours. Due to this, pharmacies will often partial fill a prescription for a 3 day supply, and then provide the rest once they get a drug order in, usually within the next day or two.
There are of course always extenuating circumstances that may occur, such as one of the patients being elderly or disabled and not being able to make a return trip to the pharmacy. It's certainly situational but the scenario I provided above in my experience is how this sort of thing would be handled.
- NYSED Office of the Professions: Laws, Rules & Regulations.