The Hadd punishment for theft is enforced on the fulfillment of various conditions regarding the thief, the victim, the object and the location in which the object was kept. It is waived under certain circumstances and if it is waived it may be replaced with a Ta'zir punishment, and the thief will also be liable to compensate the victim.
Poverty does not a excuse a thief from receiving the Hadd. However if the situation is such that the person is starving and would have certainly died if they had not stolen, then the Hadd may be waived.
الاضطرار شبهة تدرأ الحد، والضرورة تبيح للآدمي أن يتناول من مال الغير بقدر الحاجة ليدفع الهلاك عن نفسه ، فمن سرق ليرد جوعا أو عطشا مهلكا فلا عقاب عليه، لقوله تعالى: {فمن اضطر غير باغ ولا عاد فلا إثم عليه} ، وقوله صلى الله عليه وسلم: لا قطع في زمن المجاع
(my own translation so treat with caution as it is paraphrased and may contain mistakes)
Necessity is a doubt that relinquishes the Hadd, extreme need makes it permissible for a person to consume the property of another in order to avert death from themselves. Hence the person who steals to repel fatal hunger or thirst, is not given the punishment because of the saying of Allah: "But whoever is forced [by necessity], neither desiring [it] nor transgressing [its limit], there is no sin upon him." 2:173 ; And the saying of the Prophet ﷺ : "There is no cutting of the hand during a period of famine."
— الموسوعة الفقهية