It must be clear to every traveler: each traveler is responsible for his or her own personal needs. Of course, this also applies to medicines.
By the way, the traveler is also responsible for checking whether the medication can be legally imported into the country one is visiting. Even if it is for personal use. In the case of some prescription medicines, it is essential to carry a certificate of necessity from the doctor. And there are medications that are actually not allowed to be imported into other countries. This applies in particular to opiate-containing drugs, strong tranquilizers, and also strong sleeping pills.
For example: cannabis is legal in the US (and without a prescription) in many states and many people use it for medical purposes. It is illegal to bring it into many countries. Sometimes the penalties are moderate - but there are also countries with very strict penalties! Of course, then non-U.S. laws apply.
For an existing illness every guest is responsible himself. For a sudden illness, the doctor on board will try to cure with on-board remedies. If the diagnosis is clear, but the right medicine is not on board, the port agent will try to get the right medicine with the right active ingredient and give it to the guest. If the guest does not agree to take a drug he does not know and does not trust the shipboard doctor, the guest will probably have to leave the ship.