Question: Suppose there is a place for distributing flour, gas, petrol, or the like, such as treating patients in a hospital, and the custom in those places is “first come, first served”—the first is treated first. Is it permissible for someone who comes late to pay a bribe to be put ahead of everyone, or to use a friend’s intercession to be advanced ahead of all?
Answer—and Allah is the One who grants success: Jurists have stated that a judge must give precedence to “first come, first served,” to the weak, to women, and to those who have travelled from faraway regions. Based on this, precedence should be given to “first come, first served.”
Yes: here it may be permissible to give precedence to one who is not first—unlike the judge’s court, where it is not proper—lest he be suspected of bias. Observing justice in adjudication, its preliminaries, and what pertains to it is a matter that is strictly emphasized.
As for the case at hand, it is not like that; thus giving precedence to one who is not first is permissible on the condition that this does not harm others, and that is when the distribution concerns something in which people have a right.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.2