There is no direct mention of a thirteenth month in the Torah. Where does it originate from? The verse in Deuteronomy (16:1) states: "Observe the month of Spring (Aviv) and keep the Passover unto the Lord your God, for in the month of Spring the Lord your God brought you out of Egypt by night." That means that Passover must always be in the spring.
However, this poses a challenge since the Jewish calendar is lunar-based and the lunar year is eleven days shorter than the solar one. Therefore 12 Jewish lunar months “drift back” eleven days each year relative to the solar year. Therefore, in order ensure that Passover always occur in the springtime, an additional lunar month is sometimes necessary. This is done in accordance with Jewish tradition and the calculations made by our Sages.
A thirteenth month is necessary in Judaism was instituted approximately every three years – nowadays seven times in nineteen years - to replace the days that are “missing” due to the lunar cycle and the need for a “Springtime Passover”.
The Torah counts the months beginning with the lunar month of Passover – therefore Nisan is the first month. The twelfth month is called Adar. During a leap year, when a thirteenth month is added, it is also called Adar like the twelfth month. To distinguish between these two months, we refer to the twelfth month as Adar Aleph (Adar One) and to the thirteenth month as Adar Beit (Adar Two).