Do Not Steal
Stealing is forbidden.
The law nevertheless recognises a moral distinction between ordinary theft and taking something because it is genuinely necessary for immediate survival. Someone taking food because they would otherwise starve is not to be judged in the same manner as someone stealing for greed, profit, convenience, or personal enrichment.
The motive and the circumstances matter.