Not sure of how its done but there is a ceremony in the Mormon religion a person can be "sealed" to their spouse and/or children so they'll be together in heaven as well.
In the US, Husband and wife usually get sealed in the ceremony room if they are both worthy and have active recommend cards. If you're LDS and don't have recommend, you cannot enter the temple. Worthy LDS members only enter the temples. I'm told that the First Presidency will change its approach in a month or so that members will get married civilly first before they go to temple to get sealed. They believe that a family can be together for eternity after death.
In Latin America, Europe and Asia countries, by the law, LDS members have to get married civilly first before they get sealed at a temple.
When a new temple is built, the
public is welcomed to go to the Temple Open House to take look around. Many preachers and ministers usually wrote stories about their experiences after they looked at those ceremony rooms at LDS temples. It's common. When a temple became formally dedicated, they allow only worthy LDS members for now.
If they get divorced civilly, but they remained sealed from the temple, they usually write their letters and send them to the church to 'unseal' their marriage.
I know several male LDS members avoid female widows, because female widows were already sealed to their late husbands. If male lds member married her, then they cannot get sealed in the temple, because she was already sealed to her first husband. They only get married civilly. Period.
I knew a LDS widow whose husband was killed in wreck. She had been dating a LDS guy, and he asked her to marry him. She accepted it, but her family had been pressured her to not get married to LDS guy when she was already sealed to her late husband. She often fought with her family. They finally got married civilly, but they didn't get sealed in the temple. She wrote several letters to the church to ask for permission, so she can get sealed to her second husband, but the church turned her down.