|The Twelve Imams in the Old Testament|
Ibn Kathir says:
We see the following prophecy in the Taurat which is in the hands of the Jews and the Christians: "Indeed Allah, the Exalted, has given Ibrahim (a.s.) the glad tidings of Isma'il, and he has bestowed a favour and multiplied it and placed in his progeny twelve mighty (personalities)."
And he says:
Ibn Taymiyya said: "And these are the same, regarding whom the Prophet (s.a.w.s.) has given the glad tidings in the tradition of Jabir bin Samurah and stated their number; indeed this is with regard to the Imams and the Hour will not come till they last. And many of those who accepted Islam from among Jews think they are the same Imams of the Rafidi sect."  The afore-mentioned glad tiding is present in the section of Genesis (17-18:20) of our era. It is also present in the original Hebrew.
The words (of the Lord) to Ibrahim (a.s.) translated from the Hebrew are as follows:
"And as for Isma'il, I have blessed him, and I have made him fruitful. And I have truly multiplied him, he will beget twelve leaders and I will provide for him a large nation."  This also indicates that the blessings, fruits and multiplication is in the generation of Isma'il (a.s.). "Shanim Asaar" means "twelve"; and the word "Asaar" is used for a compound number when the counted things are masculine. The singular "Naasi" means: Leader, chief, head, etc. 
The Almighty Allah ordered Ibrahim (a.s.) to leave the city of Namrood and go towards Syria. So he left the city with his wife Sarah, and Lut (a.s) and migrated according to the Divine Order. In due course, they reached the land of Palestine.
By the Grace of Almighty Ibrahim (a.s.) was bestowed an excess of wealth. He said: "O my Lord what can I make by this wealth, and I do not even have a son?" The Almighty revealed to him, "I will increase your progeny till it reaches the number of stars." Hajra was the slave girl of Sarah. Sarah betrothed her to Ibrahim (a.s.). She bore for him a son, Isma'il (a.s.). The age of Ibrahim (a.s.) was 86 years when Isma'il (a.s.) was born to Hajra. 
The Holy Qur'an mentions in the following words the prayer of Ibrahim (a.s.).
"O Our Lord! Surely I have settled a part of my offspring in a valley unproductive of fruit near Thy Sacred House, Our Lord! That they keep up prayer; therefore make the hearts of some people yearn towards them and provide them with fruits; haply they may be grateful." (Sura Ibrahim 14 : 37)
The holy verse points to the fact that Ibrahim (a.s.) had settled some of his progeny, that is Isma'il (a.s.) in the area of Mecca and he also prayed that the Almighty Allah may bestow them with His Mercy and that they remain the medium of guidance for humanity till the end of time. The Almighty accepted his invocation by appointing Muhammad (s.a.w.s.) from his progeny, and after him his twelve successors as the leaders of humanity for the time to come.
Imam Muhammad al-Baqir (a.s.) says: "We are the remnant of progeny. And that was the prayer of Ibrahim (a.s.) regarding us."
 Ibn Kathir, Ta'rikh, 6:249 and 250.
 Genesis 17.
 Al Mu'jam al-Hadith.
 Al-Ya'qubi, Tarikh , 1:24-25 (Printed at Qum).