The question of when Homer's Iliad was composed is a difficult one. The story may have been passed down orally for several hundred years before it was finally written down.
Also complicating the issue is the problem of when the Trojan War took place (if it took place at all; some scholars believe the war Homer describes was not an actual historical event). The time period Homer's work appears to describe is Bronze Age Greece. Archaeologists who have worked at Troy have concluded that the level of Troy most likely to have been destroyed by war is dated to around 1200 BCE. However, the type of writing known to have existed at that time is certainly not the sort of Greek that has been passed down to us. Additionally, after 1200 BCE, numerous Greek sites were either destroyed or abandoned, indicating that the Greeks themselves were under some sort of duress. Furthermore, after this time, the ability to write seems to have been lost for some time.
Finally, though, by the 800s, Greece had emerged from its "Dark Age" and writing begins to reappear. We can get some idea of when the Iliad was written down because other Greek authors start referring to the poem. Also, we start to see Greek artists depicting scenes from the Homeric epics, especially in vase painting. The combination of literary references to the poems, artistic representations of scenes from the poems, as well as other elements found in the poems themselves have led scholars to date the writing of the Iliad to between 775 and 725 BCE. Some scholars, though, have argued that the poems did not achieve their final form until the following century.
Commonly, most historians agree that the Iliad was composed in the 8th century BC, although some think it had rather be a 7th century date.
The oldest existing written copy of Homer's Iliad is the Venetus A, created in the 10th century AD (it's the primary source for all modern editions of the poem).