This clearly shows a total lack of understanding of how pharmacies work.
Pharmacies cannot hold infinite amounts of infinite supplies of infinite medications that could possibly be prescribed on any given day "just in case".
Therefore we hold larger amounts of stock of the most common lines - amitriptyline, atorvastatin, amoxicillin, flucloxacillin, bisoprolol, omeprazole, penicillin, prednisolone, metformin, co-codamol, naproxen etc - and smaller amounts of other drugs we use often but not necessarily daily to ensure that we aren't wasting it (eg due to it expiring before it gets dispensed) but even on "fast line" items there can be a rush on them at certain times so we just don't have the stock that day but, unless it's a Saturday, the pharmacy I work in gets daily deliveries whereby as long as we order an item before 7pm it will be with us by 5pm the following day.
I work in a pharmacy within a supermarket, in the evenings (after 5pm) and at weekends there is only us and another supermarket pharmacy on the other side of town who are open, so we get every prescription from the OOH centre and/or everyone coming in after work or on Saturday with a paper prescription because it is most convenient. Unfortunately if we only have 20 boxes of flucloxacillin and 21 people are prescribed it at the OOH centre, the last person either has to go elsewhere or wait until the following day when our next delivery will arrive. We can't just magic medicine up from nowhere, we aren't pharmacists from the 19th Century who mixed up their own concoctions on site.
In the case of the person in your example, it might be that they didn't have anything sitting on the shelf but they had an item that had been dispensed for someone else but they made the decision that her need was greater and/or hedged their bets that the other person wouldn't come in for the medication that day (either due to the time or because it had been sitting waiting to be collected for a few days/weeks/months) and essentially took it off the other person to give to her. This is not best practice and sometimes even palliative care medication isn't time critical and can wait 24hrs but if not then the pharmacist will make an informed decision as to the best course of action to take, which may be taking medication from one person to give to another because they are physically there at the moment.
Of course the pharmacy is filled with bags and runs on paper - we get hundreds of electronic prescriptions sent to us each day to fulfil (as well as the walk ins, referrals, private prescriptions, online doctor orders etc) and we have to print out the prescription, put it in a basket with the items we have physically taken off the shelves as per the prescription, dispense them on the computer system, have a dispenser check the information on the sticker matches the item it is being attached to and then have the item checked by the pharmacist before they sign off to hand out. If someone isn't waiting to collect it there and then we have to file them away for collection and the easiest way to do so is to put it on a numbered shelf and then write the number on the prescription and file it away until someone comes to collect it. There's no way we could do this if every prescription was only available on a screen as opposed to a physical piece of paper that we can take to each location and can only be in one person's possession at any one time.
We also need there to be a physical prescription (or token) as prescriptions are legal documents so we have to have them for the items to be checked off and for the patient to fill in the back of with their exemption/payment and signature. We also have to physically send prescriptions to the NHS at the end of the month so we can be paid correctly for the items we have dispensed.