That’s a good question. I guess the answer depends a bit on why you are asking, but I hope my answer is helpful anyway.
Firstly, we have to note that God specifically forbids stealing in the 8th commandment (Exodus 20:15).
That being noted, your question seems to be pointing to unusually difficult circumstances. The Bible understands that sometimes people undergo extreme need and steal food to survive. Proverbs 6:30 says that from a human point of view, stealing food is understandable: “Men do not despise a thief if he steals to satisfy his hunger when he is starving. Yet it immediately adds that if he is caught he will have to pay it back sevenfold (6:31). So the only time it is understandable is when you are desperately in need. However, though it is understandable from a human point of view, it is still not right, and God never condones it.
If we go further to the source of this issue, we see that the Bible provides a more satisfying answer. Stealing comes from the desire to get what we want or think we need. Yet Jesus says that we should trust our heavenly Father to provide for all of our needs. At the same time, he shows us that we have a much bigger need than even basic food and clothing. We need forgiveness and salvation from death and judgment. This is achieved by Jesus dying in our place, taking the punishment we deserve. If we turn to him, he will forgive us and give us eternal life. And for those (and only those), who turn back to Jesus and follow him, God promises to look after all their physical needs as well. In Luke 12:22-31 Jesus says ’ “Do not worry about your life, what you will eat; or about your body, what you will wear. Life is more than food, and the body more than clothing… For the pagan world runs after all such things, and your Father knows that you need them. But seek his kingdom, and all these things will be given to you as well.”’ God is good and knows what his children need and will provide for them. So if you know that you are not one of God’s children, turn back to him and ask him to forgive you, and he will look after all your needs.
Well, what if there is no source of food available, doesn’t it seem naive to think God will provide? But we must trust that the God who created everything out of nothing, and raised Jesus from death to life, is able to provide for his children when they are in need.
At the same time, God’s provision is rational from a human point of view too. God always exhorts his children to be generous and help the poor and those in need. So God provides for his children through the generosity and provision of other believers. What if there are no other believers around. Generally believers are told to meet together with other Christians, and even when someone is converted in a remote area, those who brought the news of Jesus to that person are also obligated to provide for their needs if they are able. If there happens to be a Christian by him/herself, I believe that God will somehow provide for them if they pray to him for help. It is not wishful thinking but the promise of Jesus himself (as above).
All that being said, if in our time of weakness we steal out of dire need, the Father understands our weaknesses and will forgive us when we repent. Stealing things that we don’t need comes from our greed which is equal to idolatry in the Bible (Col 3:5), because we are serving material things, rather than God. Yet, even if we steal what we don’t really need, God is ready to forgive us when we repent, because Jesus has paid the price for all our sins. This does not mean that we should steal knowing that God will forgive. Instead, knowing God’s goodness we should ask him for all our needs and seek to please him.
I’m sure there is more to be said, but I hope this has been helpful. The ultimate reason for the testing of believers is to teach them to look to God for all their needs. If they do, God has pledged that he will not let them down.