Answer
The Twelfth Imam is not a Christian/biblical idea, but rather a concept in Shia Islam tied to Muslim beliefs about the end times. Shia Islam is the second-largest denomination of Muslims; it gives greater weight to the title Imam than does Sunni Islam. Most Shia believe there have only been twelve “true” Imams, the last of which has been hiding unseen on earth since the ninth century. According to this belief, “the last Imam” will one day return, along with Jesus Christ, to defeat Satan and an antichrist-like figure, Al-Masih ad-Dajjal.
Most Shia subscribe to an approach called Imamiyyah, often referred to in English as “Twelvers.” These Shia believe in only twelve men who can be called an “Imam.” All were born between the seventh and ninth centuries. The last, according to most Shia, was the Twelfth Imam: Muhammad bin al-Hasan (also named Abu al-Qasim Muhammad), more commonly referred to as Muhammad al-Mahdi or simply the Mahdi.
Mahdi is a title meaning “guided one.” He is anticipated as the perfect Muslim who will reappear and unite the world under Islam. According to Shia beliefs, Muhammad bin al-Hasan was born near the end of the ninth century and was no longer seen after the middle of the tenth century. This disappearance was supposedly not the result of death but of a divine cloaking, known as occultation.
The doctrine of occultation contrasts with the belief of Sunni Muslims and a small proportion of Shia Muslims who believe al-Mahdi has not yet been born. Or, at least, that he has not yet publicly appeared on the world stage. Shia belief in the role of the Twelfth Imam is at least partially responsible for Iran’s approach to international politics. Some observers of world events wonder about a possible connection between this figure and the Bible’s depiction of the Antichrist.
The Twelfth Imam is also the title of a fictional novel by Joel Rosenberg.