As long as he has intelligence and bodily strength, an intelligent person must try to avoid death. This is the duty of every embodied person. But if death cannot be avoided in spite of one’s endeavors, a person facing death commits no offense.
Srimad Bhagavata Purana
श्रीमद्भागवतमहापुराणम्
मूल श्लोकः
मृत्युर्बुद्धिमतापोह्यो यावद्बुद्धिबलोदयम् । यद्यसौ न निवर्तेत नापराधोऽस्ति देहिनः
mṛtyurbuddhimatāpohyo yāvadbuddhibalodayam | yadyasau na nivarteta nāparādho'sti dehinaḥ
SB 10.1.48