It's a generally accepted principle of the law in many countries that crimes against property cannot be punished if they were committed for the purpose of preserving one's own (or a loved one's) life. So yeah, someone who shoplifts because they're starving should not be punished or even blamed. The fault belongs to a society that gives people no other choice to avoid starving. You'd have to have the compassion of a Hugo or Dickens villain not to recognize that.
The goal should be to ensure no one has any reason to steal at all as they have a shot at making bank and prospering fairly, not to just ignore real world structural problems and let people remain poor and desperate.