Wa`alykum As-Salamu Warahmatullahi Wabarakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Answering your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
A person who is terminally ill is exempted from fasting, but he must offer fidyah (compensation) for that; compensation for skipping a fast is feeding one poor person. Allah says: “ For those who can do it (With extreme hardship), is a ransom, the feeding of one that is indigent” (Al-Baqarah 2:184)
If a person dies before having paid fidyah, then according to opinion of many scholars, it must be taken from his inheritance before it is distributed since it is a debt owed to Allah and like all debts he owes, it must be set aside before the inheritance is distributed.
If, however, a person leaves nothing behind him, then it is his children’s duty, if they can afford, to offer fidyah on behalf of their deceased father/mother.
Instead of offering fidyah, should they wish to fast, that is also considered acceptable. The Prophet, peace and blessings be upon, has reminded us, “Allah’s debts are more worthy of being settled.” (Ahmad)
Allah Almighty knows best.
Excerpted, with slight modifications, from: www.islam.ca