First, the requirement to observe Rosh Hashanah, and to incorporate the Shofar into its observance, is a divine one originating in Vayikra (Leviticus) 23:23-24
"And HaShem spoke unto Moses, saying: Speak unto the children of Israel, saying: In the seventh month, in the first day of the month, shall be a solemn rest unto you, a memorial proclaimed with the blast of horns, a holy convocation. Ye shall do no manner of servile work; and ye shall bring an offering made by fire unto HaShem".Second, the Torah portion for Rosh Hashanah (Gen 21:1-34) describes (among other things) the birth of Isaac to Abraham and Sarah. This connection of Rosh Hashanah to Isaac connects the holiday to one of the most pivotal moments in Genesis: the Akedah (the binding of Isaac). It's the story of the Akedah that provides (at least one) connection between Rosh Hashana and the Shofar. (Why the Akedah itself is not the Torah Portion for Rosh Hashanah is a good question and has been the subject of lots of discussion and many sermons. See Torah.Org for one example.)
(See the Jewish Virtual Library or your Chumash or Tanakh of choice)
While I can't claim any real experience studying Talmud, I have a copy of Bialik and Ravnitzky's "Sefer Ha-Aggadah - The Book of Legends: Legends from the Talmud and Midrash." Sefer-Ha-Aggadah provides this explanation from the early Midrash, attributed to Reb Yohanan, citing Reb Yose ben Zimra (from the Tanhuma Midrash, I think.):
Abraham: "When You (Hashem) commanded me to sacrifice Isaac, I should have replied: Yesterday You told me, 'In Isaac shall th seed be called' [Gen 21:12]; Now you say to me, 'Offer him there for a burnt offering' [Gen 22:2]. Nevertheless, I restrained my impulse and did not reply as I should have done. Even so now [I say to You], When Isaac's children shall sin and find themselves in distress, be You mindful on their behalf of the binding of Isaac; let it be reckoned in Your presence as though his ash were in fact heaped upon the alter - be then filled with compassion for his children, forgive them, and redeem them from their distress." The Holy One replied, "You had your say, and now I will have Mine. Isaac's descendants will sin in My very presence, and I will have to judge them on New Year's Day. However, should they implore Me to seek out some merit on their behalf, and to remember on their behalf the binding of Isaac, let them blow in My presence the horn of this creature." Abraham: "The horn of what creature?" God: "Turn around." At once "Abraham lifted up his eyes, and looked, and behold a ram" [Gen. 22:13).And there it is...on Rosh Hashanah we blow the ram's horn to implore God to remember the merit of Isaac and Abraham, and to remind ourselves of their merit. (And to inspire us to live up to it.) We play the music of the shofar to remember.
After writing the above I found this description in the online Jewish Enclyopedia (1906):
The "teḳi'ah" and "teru'ah" mentioned in the Bible were respectively bass and treble. The teḳi'ah was "a plain deep sound ending abruptly; the teru'ah, a trill between two teḳi'ahs. These three sounds, constituting a bar of music, were rendered three times: first in honor of theocracy, or "malkiyot" (kingdom); then to recall the 'Aḳedah and to cause the congregation to be remembered before God, or "zikronot" (remembrances); a third time to comply with the precept regarding the shofar. Ten appropriate verses from the Bible were recited at each repetition, which ended with a benediction (R. H. 16a). Doubt, however, arose as to the sound of the teru'ah. Onḳelos translates "teru'ah" as "yabbaba"; but the Talmud is uncertain whether it means an outcry ("yelalah") or a moaning ("geniḥah") sound. The former was supposed to be composed of three connected short sounds; the latter, of nine very short notes divided into three disconnected or broken sounds ("shebarim"). The duration of the teru'ah is equal to that of the shebarim; and the teḳi'ah is half the length of either (R. H. iv. 9). This doubt as to the nature of the real teru'ah, whether it was simply an outcry or a moan, or both, necessitated two repetitions to make sure of securing the correct sound, the following formula, consisting of ten sounds, resulting: teḳi'ah, shebarim-teru'ah, teḳi'ah; teḳi'ah, shebarim, teḳi'ah; teḳi'ah, teru'ah, teḳi'ah. This formula was repeated twice, making thirty sounds for the series. The last teḳi'ah was prolonged and was called "teḳi'ah gedolah" = the "long teḳi'ah." This series of thirty sounds was repeated twice, making ninety sounds in all. The trebling of the series was based on the mention of teru'ah three times in connection with the seventh month (Lev. xxiii. 24, xxv. 9; Num. xxix. 1), and also on the above-mentioned division into malkiyot, zikronot, and shofarot. In addition a single formula of ten sounds is rendered at the close of the service, making a total of 100 sounds. Thus the original three sounds, constituting a musical bar, were increased to 100 at the New-Year's Day ceremony.