Yes, but only in real necessity, without desiring it and without going beyond what is needed. Allah says that whoever is forced by necessity, neither desiring it nor exceeding the limit, is not sinful (2:173).
This is general information, not a fatwa. For your own situation, ask a qualified scholar.
Questions about halal and haram
Is something haram allowed in an emergency?
Yes, but only in real necessity, without desiring it and without going beyond what is needed. Allah says that whoever is forced by necessity, neither desiring it nor exceeding the limit, is not sinful (2:173).