What is the ruling on not registering the marriage?
Question

In our country, if the husband dies, the wife is entitled to receive benefits called a pension. But if she gets married to someone else, the state will stop paying her this pension. Some widows resort to not registering their new marriage, so that they can keep the pension from the first husband. This unregistered marriage is done with a guardian and witnesses (it is done openly), but it does not give any rights to the wife according to the state. So if her husband dies, she cannot inherit from him, and if he divorces her, she has no right to maintenance. The state does not recognize this marriage except in the case that the couple have children. We are not living in a tribal society where the tribe will guarantee people’s rights. I know that the pension that the wife is receiving is haram, but what is the ruling on this unregistered marriage?
Praise be to Allah.Firstly:
If the pension is given by the state to widows only, and it ceases if she remarries, it is not permissible to use tricks to get it, because that comes under the heading of consuming wealth unlawfully. Allah, may He be exalted, says (interpretation of the meaning):
{O you who have believed, do not consume one another's wealth unjustly} [an-Nisa’ 4:29].
Secondly:
In order for marriage to be valid, it is stipulated that both spouses consent to it, and that the wedding be attended by the woman’s wali (guardian) and two witnesses of good character who are Muslims, and that there be no impediment on the side of either of the spouses.
If these conditions are met, and the marriage contract is done with the proposal and acceptance from the woman’s guardian and the suitor, then the marriage is valid.
With regard to registering the marriage with the government, that is in order to protect the rights of both spouses and avoid disputes.
What appears to us to be the case is that registering the marriage is obligatory now, because there are so many dishonest people, and because people’s religious commitment is weak, and because of what results from not registering the marriage of people’s rights being lost, such as inheritance, the delayed portion of the mahr, maintenance and guardianship over the wife and her children. Moreover, the man may mistreat his wife and cause her harm, then refuse to divorce her, so she will remain suspended, unable to marry someone else according to sharia, and unable to refer the matter to the court to compel her husband to divorce her.
Or the wife may go astray and fall in love with another man, and marry him, leaving behind her husband who has no power to take her back.
There are those with sick hearts and no conscience who get married without registering the marriage, then disown the wife and her children, and do not recognize them as their children.
Based on what we have noted above about all these negative consequences, the view that it is obligatory to register the marriage is clearly valid.
And Allah knows best.