When you say "judged" I assume you mean something like "prosecuted" or "punished."
If so, the best argument for this is that the man would surely have had other things that he could have tried before stealing the medicine.
If a man truly needed some medicine and he could not afford it, it seems very likely that he could have some other options for obtaining the medicine. At the very least, he could have gone to the person who owned the store and explained his situation. Ethically speaking, he should have done this. He should have gone in, explained, arranged some sort of way to pay (work for the drug store owner, etc). He should have tried all of these things so that he would not have to do something unethical to the owner of the store.