All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad
is His slave and Messenger.
If by secret marriage you mean a marriage that was not publicly announced and not officially registered with the courts or relevant authorities, but was conducted through a legal guardian (walī) in the presence of two Muslim witnesses, then the marriage contract is valid.Ibn Qudāmah رحمه الله said in al-Mughnī: “If he contracts the marriage with a guardian and two witnesses, secretly, then the marriage is valid.” [End quote, paraphrased.]
If the contract was concluded over the phone, while the witnesses were able to hear the wording of the marriage contract, then some scholars have held such a contract to be valid. This was also the fatwa of Shaykh Ibn Bāz رحمه الله. Accordingly, the marriage is valid and the pregnancy is legitimate.
However, if what occurred between you and the man was merely an offer and acceptance over the phone, without a guardian and without witnesses, then this is an invalid marriage by the consensus of the Imams of the four schools of thought. Nevertheless, intercourse that occurred after such a contract establishes the lineage of the child. Shaykh al-Islām Ibn Taymiyyah رحمه الله said: “If a man marries a woman without a guardian and without witnesses, while concealing the marriage, then such a marriage is invalid by the consensus of the Imams. However, if he believed that the marriage was valid, then the intercourse that occurred is regarded as intercourse based on a mistaken assumption of legality. Consequently, the child is attributed to him and inherits from his father.” [End quote, summarized from al-Fatāwā al-Kubrā]
Lastly, if the official contract was conducted through the guardian and witnesses, then it is valid, and the existence of pregnancy does not prevent the validity of the marriage, as preferred by Ibn Qudāmah رحمه الله in al-Mughnī.
Allah knows best.