Usually yes, with arrangements made in advance rather than on arrival. Bring enough medication for the full trip plus delays, keep essential doses in your carry-on in original labelled packaging, and carry a prescription list or a doctor's letter. Check the rules of every gateway country for controlled or injectable medication. For devices, approval is ship and device specific, so ask before you book.
Refrigeration, sharps disposal, electrical backup and storage all have to be arranged with the operator ahead of time. Don't assume the clinic will hold your medication or that a cabin fridge exists.
For devices, the questions to ask are voltage, plug type, battery rules, backup power, cabin storage, distilled water where relevant, oxygen restrictions and what happens in an emergency. Some operators permit personal oxygen concentrators while prohibiting compressed or liquid oxygen. Some ships cannot support dialysis at all.
One thing to be firm about: never book on the assumption that a ship's emergency oxygen or medical equipment can be used for routine personal treatment. That equipment exists for emergencies and it isn't a substitute for your own arrangements.