this is the kind of made up scenario people use to probe ethical quandaries. Check this popular course by Harvard philosopher Michael Sandel
If this is a question of morality/ethics, then answer will be subjective (i.e. there's no right answer, other than to refrain/repent/restitute). If it's a question of fiqh (i.e. what's the punishment for a destitute one who steals due to his trying circumstances), then it is 'probably' analogous to hanafi ruling on theft of items of insignificant value.
I think the principle is, to save a life, you can commit haram to the minimal degree. So if she needs it urgently and he can't wait a minute, then take it and give it to his wife. Then come back and discuss with the pharmacy and get help off others.
Lol can’t he ask the pharmacist and explain his predicament? I’m sure people would help if he reached out to organisations or mosques?
But if she needs the medicine immediately, otherwise she'll die, then maybe that's a different answer...
There was a husband and wife.The wife was ill and needed treatment.The medication prescribed worked well for her and she began to recover.However as time went on he could no longer afford the medicine that was making her better.So one day he was at the pharmacy and the medicine she needed was there and there was no one behind the counter so it was a good chance to steal it. Islamically should he steal the medicine?