It's probably different in the US but here in Canada a doctor can prescribe for a non-patient under certain specific circumstances. Because this is Canada one of those circumstances likely would not be because the person in need cannot afford to get medical care . I don't know if that would be considered an adequate reason should he/she be challenged by someone in the US. Here one reason why a Doctor would be sanctioned for prescribing for a non-patient is because of the idea of prescribing for Internet patients. But mainly that is because one of the things a doctor is expected to do is to actually have met with and examined a non-patient and follow up with them afterwards. Given the doctor in your situation knows the person involved they might be able to argue that they were in a position to assess them and can follow up with them if there are complications from the prescription.