Prescription medications are legal for those with the right prescription, but that is as far as the legality extends. Only the person with the prescription is allowed to use the medication, and they have to follow the dosage directions and any warnings — such as not driving after using it.
This is important to point out because people sometimes unexpectedly find themselves facing drug charges for sharing their prescriptions. They assume that the drugs are simply a medication that they own, that they got legally (which they did) and that they can use as they wish. If they know someone else who wants to try a specific drug or who has similar symptoms and wants to know if it works, they share it without thinking, just feeling like they are trying to help out someone in need.
Your intentions may be good in a situation like this, but sharing prescriptions is always against the law. If you are caught, you could be charged with drug-related crimes, such as distribution.
It can also be dangerous
The other thing to remember is that sharing can be dangerous. Doses are set for each individual person. Giving someone else your dose may be harmful to them, even when it is helpful to you. This is why only trained medical professionals are supposed to determine who gets which drugs and how much they get.
If an innocent mistake leads to serious drug charges, you are likely going to be worried about your future. How is this going to impact and potentially change your life? Take the time to look carefully into all of the legal options you have.