Founded by Elendil and his sons at the end of the Second Age, Osgiliath straddled the Great River Anduin at a point approximately half way between the cities of Minas Anor to the west and Minas Ithil to the east. After Minas Ithil fell and became Minas Morgul, Osgiliath came under siege and was eventually abandoned, and the capital was moved to Minas Anor - now renamed Minas Tirith. During the War of the Ring the men of Gondor were hard pressed to prevent the enemy from breaking through at Osgiliath and were eventually forced to abandon it, shortly before the Battle of the Pelennor Fields. After the destruction of the One Ring, Osgiliath was rebuilt.
The name "Osgiliath" is Sindarin for "Dome of Stars", referring to the city's most prominent building, a great dome which once housed the city's Palantír. (Osgiliath's Palantír was lost in the river, during the Kin-strife in the time of Eldacar, T.A. 1437.)
In Peter Jackson's film of The Two Towers, Faramir takes Frodo, Sam and Gollum to Osgiliath, where they witness a major battle. This scene does not occur in the book.