The purpose behind having witnesses when the marriage contract is done is so that her the proposal from the woman's wali (guardian) or from the one who is acting in his stead, such as a wakeel (deputy or proxy), will be heard, and the acceptance from her husband or one who is acting in his stead, will be heard too. If the proposal and acceptance are written down and the witness's is deaf, for example, and he witnessed what was written during the marriage contract, then his testimony is valid, because Allah says (interpretation of the meaning): except for those who bear witness to the truth knowingly [al-Zukhruf 43:86]. If the knowledge of what is happening reaches the witness, that is sufficient.
Al-Sharh al-Mumti, 5/162
Some of the scholars are of the view that announcing and publicising the marriage and informing the people of it is sufficient and there is no need for special witnesses; rather it is stronger than that. Shaykh Ibn Uthaymeen (may Allah have mercy on him) said:
Some of the scholars said that it is stipulated that the marriage should either be witnessed or announced, i.e., proclaimed openly, and that if it is announced, that is sufficient, because it is furthest removed from any doubt. There are some reservations about not having the marriage witnessed is risky, because a man may commit zina with a woman, then if she gets pregnant from him, he will claim that he married her, when that is not the case. So having the marriage witnessed is stipulated for this reason.
But if it is announced, then this reservation no longer applies, because it is stronger than just having it witnessed. This is the view favoured by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him), as he stipulated either having the marriage witnessed or announcing it. He (may Allah have mercy on him) said: If there are witnesses but the marriage is not announced, then there is some doubt as to whether the marriage contract is valid, because the Prophet (blessings and peace of Allah be upon him) enjoined that marriages be announced, and said: Proclaim the wedding. And because there is the fear that secret marriage will lead to negative consequences, even if it is witnessed, because a man may commit zina - Allah forbid - with a woman then say: I married her,' then he summons two false witnesses and they give their (false) testimony.
End quote from al-Sharh al-Mumti, 5/160
This proves that announcing the marriage is stronger than only having the marriage contract witnessed.
Shaykh al-Islam (may Allah have mercy on him) summed up the issue of having the marriage witnessed and announcing it by saying: There is no doubt that doing the marriage contract along with announcing the marriage is valid, even if it is not witnessed by two witnesses, but if it is concealed and witnessed, this is something concerning which there is some doubt.
If it is both witnessed and announced, there is no doubt as to its validity in this case.
If it is neither witnessed nor announced, then it is invalid according to all scholars, and if there is any difference of opinion, it is very little.
End quote from al-Ikhtiyaaraat al-Fiqhiyyah, p. 177
The words There is no doubt that doing the marriage contract along with announcing the marriage is valid, even if it is not witnessed by two witnesses' indicate that there is no need to worry about what you mentioned. Even if we assume that the witnessing was not valid, announcing the marriage is sufficient in sha Allah.
But it should be noted that the word witness does not apply only to the one who signs the marriage contract; rather it refers to everyone who is present when the marriage contract is done, such as the scribe, relatives, the official and others. They are all witnesses to it, if they are fit to be witnesses.
And Allah knows best.
Reproduced from Islam QA