Rosh Hashanah is observed as a two-day holiday, on the first and second of Tishrei, even though the Torah ordains only one day, as the verse (Vayikra 23:24) states: And in the seventh month, on the first of the month, you shall observe a cessation of work - a day of remembrance, of the sounding of the shofar. The first day of Rosh Hashanah can fall only on the following days: Monday, Tuesday, Thursday, or Shabbat. This regulation is an ordinance of the Sages.
The Talmud Yerushalmi (Eruvin 3:9) notes that our two-day celebration of Rosh Hashanah is an enactment of the early Prophets, who established it for the following reason. During the period of the Prophets, the sanctification of the months was dependent upon hearing the testimony of witnesses who had seen the new moon. On the evening following the twenty-ninth day of Elul, the court would sanctify the day as the first of Tishrei based on the possibility that witnesses might come that day and testify that they had seen the new moon, retroactively establishing Rosh Hashanah on that day. If the witnesses did indeed appear, then that day would be sanctified and the following day would be a regular day - the second of Tishrei. However, if witnesses did not appear, then the following day would be Rosh Hashanah and retroactively, the previous evening - which the court had sanctified - would turn out to be a regular weekday. So that people would not treat the first day lightly, since its sanctified or weekday status was dependent upon the appearance of witnesses during the course of the day, the early Prophets ordained that Rosh Hashanah be celebrated as a twoday holiday - with the prohibition of work, the sounding of the shofar, and the order of prayer being observed on both days.
The two-day celebration of Rosh Hashanah is referred to as yoma arichta - a long day; i.e., the forty-eight hour observance of Rosh Hashanah is considered one extended day. Both days are sanctified definitively [in contrast to the second day of the Festivals celebrated in the Diaspora, whose sanctity is based on doubt]. Regarding preparation, however, they are considered to be two separate days and thus one may not prepare food on the first day for the second.
The Rambam (Hilchot Kiddush ha-Chodesh 5:7-8) writes:
The Festival of Rosh Hashanah - in the period when they would establish (the calendar) based upon testimony - was celebrated by the majority of the residents of the Land of Israel for two days because they were in doubt [as to when the Festival began], for they did not know when the court had established the new month since the agents of the court did not go out on a Festival. (That is, since Rosh Hashanah is the only Festival celebrated on the first of a month, there was no means of informing those who lived outside of Jerusalem that the court had accepted testimony that the new moon of Tishrei had been sighted. Once the month was established, Rosh Hashanah would begin and the agents of the court would be unable to inform the populace since they could not travel on a Festival.)
Moreover, even in Jerusalem, the site of the court, two days of Rosh Hashanah were often celebrated. (Even) if witnesses did not appear at any rime on the thirtieth day [i.e., thirty days after the new moon of Elul, when the new moon of Tishrei should have been seen), they would sanctify that day on which they waited for the witnesses. (If witnesses appeared during the day, the court would have to retroactively establish the day as Rosh Hashanah. Since it was not unlikely that witnesses would indeed appear during the day, given that it was the thirtieth day after the new moon of Elul, the court would sanctify the day as Rosh Hashanah even before they appeared. Had the court not done so and waited for the appearance of witnesses, if the witnesses appeared in the late morning of the thirtieth, Rosh Hashanah would be established as falling on that day and the people would be retroactively culpable of having violated the sanctity of the day.) The following day would also be sanctified [if the witnesses did not appear until then]. Thus, since they celebrated two days of Rosh Hashanah even during the period when the months were sanctified based on the testimony of witnesses, it was ordained that all Jews - even those living in the Land of Israel - should celebrate two days of Rosh Hashanah now that the calendar is based upon calculation. We thus see that the celebration of the second day of Rosh Hashanah nowadays is also a regulation of the Sages [similar to the second day of the Festivals that is celebrated in the Diaspora].
What then is the difference between the second day of Rosh Hashanah celebrated when the months were calculated based on testimony, and the second day celebrated nowadays? In the former period, if witnesses did not appear, the first day celebrated would retroactively turn out to be a Rabbinical obligation and the second day would be a Torah obligation. Nowadays, when the calendar is based on fixed calculations, the first day of Rosh Hashanah is a Torah obligation and the second day is a Rabbinical enactment.