If you do die before you are able to withdraw your 3a savings at the age of 59 (women) or 60 (men), your savings will be go to your spouse. If you do not have a spouse, your 3a assets will be divided amoung your dependent children.
If you do not have a spouse or dependent children, priority goes to parents of your dependent children or partners with whom you have lived for at least 5 years. Your parents are next in line, followed by your siblings and finally by any other legal heirs as per inheritance law (more on that here: /en/inheritances-switzerland-rules). You may leave a certain portion of your assets to another entity by clearly stating this in your will.
If you do not have a family or for any other reason you do not want to leave your assets to your legal heirs, your only options are to either become self-employed (if you are currently employed), invest in a property as per the pillar 3 property allowance, or to relocate from Switzerland to another country. In these situations you are allowed to withdraw your 3a savings.