Two witnesses are needed for a marriage contract. The Prophet (peace and blessings be upon him) said: “There is no marriage without a wali (guardian) and two witnesses.” The witnesses should be sane and mature. They should identify the two spouses and be aware of all the needed requirements of marriage, such as dower. That has nothing to do with being a relative or not. Moreover, the imam or the person who handles the marriage contract could be counted as a witness. As long as the marriage is established on a mutual approval in front of the two witnesses, the marriage is valid.

In his well-known book, Fiqh As-Sunnah, Sheikh Sayyed Sabiq states: The conditions required in witnesses (to a marriage contract) are: to be of sound mind, to have reached the age of puberty, to be of sound hearing so that they can hear and understand what the parties to the contract are concluding.
Accordingly, if a boy, an insane, dumb, or drunk person witnessed a marriage contract, it would not be valid, for he could not get what he was witnessing.
As for the uprightness of the witnesses, the Hanafi school believes that it is not a condition for them to be upright. The Hanafi scholars are of the opinion that a corrupt person may attest to the marriage contract and that whoever may be a bride’s guardian may also serve as a witness to a marriage contract, for the purpose of having witnesses to the marriage contract is principally to make it public.
But the Shafi`i scholars are of the opinion that the witnesses to a marriage contract are to be upright, for the Prophet (peace and blessings be upon him) said: “There is no marriage without a wali (guardian) and two upright, trustworthy witnesses.”

The Shafi`i scholars differed as to the validity of the marriage contract if the uprightness of its witnesses was not known to people. The prominent opinion in the school is that the contract be valid, for marriages take place among average, common people, and if they were made responsible to know the inward uprightness of witnesses, it would cause them difficulties.
Accordingly, the criterion for regarding a witness to be upright is to appear so to people. This entails that if a witness is proved not to be upright after concluding the marriage (not before it), this is not to affect the validity of the marriage.
The Shafi`i and Hanbali scholars believe that the witnesses to a marriage contract are also to be male. According to them, if a man and two women attested to a marriage contract, it would not be valid. They cite as evidence in that regard a statement reported by Abu `Ubayd from Az-Zuhri who said: “It was regarded as Sunnah of the Prophet (peace and blessings be upon him) that women are not to bear witness in cases with regard to punishments, marriage, and divorce.” They also give as reasoning for their opinion that the marriage contract is not like business contracts and is usually attended by men, so, the testimony of women would not be effective in proving it.
On the other hand, the Hanafi scholars believe that women’s testifying to a marriage contract is valid. They say that it is valid that a man and two women bear witness to a marriage contract, as is the case of two men. They cite as evidence of their view Almighty Allah’s words: “And call to witness, from among your men, two witnesses. And if two men be not (at hand) then a man and two women, of such as ye approve as witnesses.” (Al-Baqarah: 282). They also say that a marriage contract is like the sale one in that there is a mutual compensation for the contracting parties, and so, it may be proved by the testimony of two women with a man.
As for it being a requirement that the witness be Muslim, there is no scholarly difference as to that when the contracting parties are both Muslims. The scholars have differed when the groom is a Muslim and the bride is Christian or Jew. According to Imam Ahmad, Imam Ash-Shafi`i and Muhammad ibn Al-Hassan, if a non-Muslim bore witness to a marriage contract in which the groom is Muslim, it would be invalid, for the testimony of a non-Muslim is not acceptable in the marriage of a Muslim. Abu Hanifah and Abu Yusuf, however, view that the testimony of two Christian or Jewish men to the marriage contract of a Muslim man to a Christian or Jewish woman is acceptable. According to the above fatwa, it does not matter whether the witnesses are relatives of the spouses or not. What matters is that they meet the above mentioned conditions.