Although it is possible for the imam (as) to have a spouse and children, and such a matter is in no way in conflict with his occultation, nevertheless, there isn't any substantial hadithic reasoning that proves anything regarding this subject. It can be said that just as how Allah (swt) wished for the imam to be in occultation, He also wished for this subject to remain unclear as well.
Imam Mahdi’s (as) personal life is an issue that one can barely reach any certain conclusions on, but some possibilities can be presented considering the hadiths there are on it. Concerning the question regarding Imam Mahdi’s (as) having a spouse and children or not, there are three possibilities:
a) The imam hasn’t married anyone.
b) He has married but doesn’t have any children.
c) He has married and has children as well.
The first necessitates that the imam hasn’t performed one of the greatest Islamic traditions and it doesn’t seem like he would disregard such an important tradition.
Of course, some have said that Imam Mahdi’s (as) occultation is more important than the tradition of marriage, and there is nothing wrong with not performing a tradition when there is a more important one in conflict with it. But this isn't true, because there is no conflict between marriage and the imam’s occultation to begin with.
As for the second possibility, although it doesn’t bear the problem of the first, there is another question that needs to be answered about it, which is: “Does the imam’s spouse also have a prolonged life like the imam or not; or is it that the imam chooses different spouses in different time periods?” There isn't any way to find the answers to these questions though, but what can be said is that there is nothing indifferent about the imam having multiple wives. Just because he is in occultation doesn’t mean that he is to only have one spouse with a prolonged life like his, because according to some hadiths, his occultation is an occultation of his title, not his physical body [meaning that he is seen by normal people, the only thing is that they don’t recognize who he is]. Therefore he can interact with others and even live with them, without them ever knowing who he really is.
This same question comes up for the third possibility as well, in addition to the fact that many have said that it there is only a slight possibility of such a thing taking place, because if the imam was actually to have children, they would eventually ask about their roots and background and such would be in conflict with his occultation. There are no hadiths that back any of these three possibilities.
Sheikh Tusi reports Imam Sadiq (as) saying: “لا یطلع علی موضعه احد من ولده و لا غیره” (None of his children or anyone else is aware of his whereabouts) , but Nu’mani narrates this hadith another way: “لا یطلع علی موضعه احد من ولی و غیره” (No friend or anyone else is aware of his whereabouts).
Considering this difference in narration, one can't rely on Sheikh Tusi’s narration to prove that the imam (as) has children; as a matter of fact, Nu’mani’s narration seems better than Tusi’s, because of its better chain of narrators and the wording of the hadith.
These issues have given rise to some justifying Tusi’s narration by saying that exaggeration has been utilized in it; what the narration is saying is that even if the imam was to have any children, they wouldn’t know where he is, not that the imam (as) actually has children.
There are also other hadiths that both have problems in their chains of narrators and aren’t speaking of the imam’s family during his occultation, but are talking of his family during his return. For example, Ibn Tawus narrates from Imam Ridha (as): “اللهم اعطه فی نفسه و اهله و ولده و ذریته”. Imam Sadiq (as) has also been reported saying: “کانی اری نزول القائم فی مسجد السهلة باهله و عیاله”.
Some have tried to say that the imam (as) has children on the “Khadhra’” [Green] Island and that they are governing it. Nevertheless, it must be said that the story of this island is nothing more than a myth and is more of an imaginative story than something real.
Allamah Majlisi comments on this matter saying: “Since this story can't be found in any authentic sources, I have brought it in a separate chapter.”
Sheikh Agha Bozorgh Tehrani considers it an imaginative story as well.
Conclusion: Although it is possible for the imam to have a spouse and children, there aren't any authentic hadiths on this subject that one can depend on for a certain conclusion. On the other hand, there is no substantial evidence that the imam (as) would disregard such an important tradition as well.
 For example: Imam Sadiq (as) says: “Imam Mahdi (aj) comes and goes amongst the people, he walks in the bazaars and sometimes even sits on the rugs of his friends’ houses, but no one recognizes him.” Kitabul-Gheiybah, pg.164.
 Sheikh Tusi, Kitab Gheybah, pg. 102.
 Nu’mani, Gheybah, pg. 172; Muntakhabul-Athar, pg. 252, quoted from Imamat va Mahdaviyyat, Pasokh be dah Porsesh, Zendeganiye Shakhsiye Hazrate Mahdi (aj), pg. 54; Al-Akhbarul-Dakhilah, vol. 1, pg. 150; Tarikhul-Gheybatil-Kubra, vol. 2, pg. 65, quoted from Jazireye Khazra dar Tarazuye Naqd by Seyyid Jafar Murtadha Ameli, pg. 218.
 Muhammad Sadr, Tarikhul-Gheybatil-Kubra, vol. 2, pg. 65.
 Ibn Tawus, Jamalul-Usbu’, pg. 510, quoted from Jazireye Khazra dar Tarazuye Naqd, pg. 219.
 Biharul-Anwar, vol. 52, pg. 317.
 For further information, see: Dirasatun fi Alamatil-Dhuhur wal-Jaziratil-Khadhra’, Seyyid Jafar Murtadha Ameli, pg. 263 or the translation of this book, pp. 217-225.
 Biharul-Anwar, vol. 52, pg. 159.
 Al-Dhari’ah fi Tasaniful-Shia, vol. 5, pg. 108.
 In the book Ithbatul-Wasiyyah, Mas’udi reports Imam Ridha (as) saying that if any hadith ever says that no imam passes away unless he sees his son, it doesn’t apply to Imam Mahdi (aj). See: Imamat va Mahdaviyyat, Safi Golpaygani, Pasokh be dah Porsesh (Answers to ten Questions), pp. 53-56; Chashm be Rahe Mahdi (aj), a group of writers of the Howza Magazine, pp. 351-356; Jazireye Khazra dar Tarazuye Naqd, pp. 217-221.