The Messiah and Yahya (peace be upon them) were maternal cousins
Question

                Was Maryam (peace be upon her) the only child of her family? If that is true, then how could the Messiah (peace be upon him) and Yahya (peace be upon him) be maternal cousins?.
Praise be to Allah.What the historians and biographers say is that ‘Imraan, the father of Maryam, was married to a woman who was called Hannah, and Zakariyah (peace be upon him) was married to a woman called Eeshaa’. ‘Imraan and Hannah produced Maryam (peace be upon her) and Zakariyah and Eeshaa’ produced Yahya (peace be upon him).  
Then they differed as to who Eeshaa’ the mother of Yahya (peace be upon him) was. There are two views. 
 1 –That she was the sister of Maryam (peace be upon her). This is the view of the majority, as was stated by Ibn Katheer in al-Bidaayah wa’l-Nihaayah (1/438) 
Based on that, ‘Eesa and Yahya (peace be upon them) are maternal cousins in the real sense, because they are the sons of two sisters (Maryam and Eeshaa’). 
They quoted as evidence the apparent meaning of the hadeeth of the Mi’raaj (Prophet’s ascent into heaven) which was narrated from Maalik ibn Sa’sa’ah (may Allaah be pleased with him), that the Prophet of Allaah (peace and blessings of Allaah be upon him) told them about the night on which he was taken on the night journey. Among the things he said was: “Then he went up until he came to the second heaven, and he asked for it to be opened. It was said: ‘Who is this?’ It was said: ‘Jibreel.’ It was said: ‘Who is with you?’ He said: ‘Muhammad.’ It was said: ‘Has (Revelation) been sent to him?’ He said: ‘Yes.’ It was said: ‘Welcome to him, what a good person has come.’ And it was opened. When I entered, I saw Yahya and ‘Eesa – who are maternal cousins. He said: This is Yahya and ‘Eesa, and he greeted them with salaam and I greeted them too, and they returned the greeting. Then they said: Welcome to the righteous brother and the righteous Prophet.’” Narrated by al-Bukhaari (3207) and this version is his; also narrated by Muslim (164). 
2 – That Eeshaa’ was the sister of Maryam’s mother Hannah, so Eeshaa’ was the maternal aunt of Maryam (peace be upon her). This is what was mentioned by Ibn Ishaaq and Ibn Jareer. Jaami’ al-Bayaan (3/234). This was the only view mentioned by al-Haafiz ibn Harar in Fath al-Baari (6/68). 
Based on this view, how could ‘Eesa and Yahya (peace be upon them) be maternal cousins? 
They said:  Because the mother’s maternal aunt is like a real maternal aunt, so the mother of Yahya was the maternal aunt of Maryam and she was also the maternal aunt of Maryam’s son ‘Eesa (peace be upon them all). Just as Maryam was the maternal cousin of Yahya, so her son ‘Eesa was also his maternal cousin. 
Imam Abu’l-Sa’ood said in his Tafseer (2/27): 
As for the words of the Prophet (peace and blessings of Allaah be upon him) about Yahya and ‘Eesa (peace and blessing be upon them), “maternal cousins”, it was said that the meaning of this is that the word sister was often used to refer to the daughter of the sister, thus the Prophet (peace and blessings of Allaah be upon him) regarded them as maternal cousins. End quote. 
Their evidence for that is that it is well known that the wife of ‘Imraan, Hannah, had not become pregnant and had not given birth. When she became pregnant with Maryam by Allaah’s Leave, she vowed to dedicate the child to Allaah and to service in the sacred House (Bayt al-Maqdis, i.e., the Temple in Jerusalem). This is what is supported by the Qur’aanic passage. 
Allaah says (interpretation of the meaning): 
“(Remember) when the wife of ‘Imraan said: ‘O my Lord! I have vowed to You what (the child that) is in my womb to be dedicated for Your services (free from all worldly work; to serve Your place of worship), so accept this from me. Verily, You are the All-Hearer, the All-Knowing’”
[Aal ‘Imraan 3:35]
Ibn Katheer (may Allaah have mercy on him) said in Tafseer al-Qur’aan al-‘Azeem (1/478): 
Muhammad ibn Ishaaq said: She (i.e., the wife of ‘Imraan) was a woman who did not get pregnant, but one day she saw a bird feeding its chicks and she longed for a child, so she prayed to Allaah to bless her with a child, and Allaah answered her prayer. Her husband had intercourse with her and she became pregnant. When she realized that she was pregnant, she vowed that the child would be dedicated to worship and service of the sacred House, and she said: “O my Lord! I have vowed to You what (the child that) is in my womb to be dedicated for Your services (free from all worldly work; to serve Your place of worship), so accept this from me. Verily, You are the All-Hearer, the All-Knowing” i.e., the One Who hears my du’aa’ and knows my intention. End quote. 
And Allaah knows best.