There is no compulsion in religion.
(Surah al-Baqarah, 2:257).
What this means is that there is no compulsion in entering or leaving a religion. However, when we choose to remain followers of a religion, we cannot pick and choose what we want to follow or do not want to follow. The marriage of an Ahmadi Muslim must be done as Islam has taught.
Despite this, if an Ahmadi Muslim were to marry someone only through court and without performing a nikah, the marriage would still be considered technically valid. Their relationship would not be considered fornication, nor would their children be considered illegitimate. Although their marriage ceremony would not be according to the traditions of Islam and the rules of the Jama‘at, their marriage would be considered valid just as the marriage of non-Muslims is considered valid. It is commendable and virtuous for a Muslim to perform nikah in the Islamic tradition; as during the nikah ceremony, prayers are offered for both parties, some advice and guidance is given to both families in light of the teachings of the Holy Quran and Hadith and they become aware of the Islamic ways and traditions pertaining to matrimonial affairs.
If nikah were the only valid means of marriage, then all of the Companions ra who accepted Islam would have had their marriage ceremonies repeated, but obviously this was not done. In fact, Hadrat Khalifatul-Masih IV rta said that if an Ahmadi girl gets married to a non-Ahmadi, and later she repents and is forgiven, then she would not be required to separate from her non-Ahmadi husband (Question Answer Session, March 8, 1986).
This shows that even a marriage done against the teachings of Islam Ahmadiyyat is considered valid. In essence, a marriage is an announcement of a relationship and is a universal practice, and is therefore fundamentally regarded as valid.
However, the Jama‘at requires that Ahmadi members of the Jama‘at must perform their marriage according to the teachings of the Holy Prophet sas and the system the Jama‘at has established. If a person defies this rule while being a member of the Jama‘at, in such cases, Jama‘at may take some disciplinary action.