The Dead Marshes are an ancient battlefield (Battle of Dagorlad), outside of Mordor. The last alliance fought the forces of Mordor and it was here, the fallen had laid to rest. Through the years, the battlefield became marshes and swallowed up the dead. Frodo, Sam, and Gollum took a passage through "The Dead Marshes". Candles and lights danced about and Frodo was mesmerized by the lights and tried to reach out and touch the faces of the dead, at the bottom of the marshes.
In the Tolkien Letters, Tolkien speculated that the description of the Dead Marshes may have been based on his personal experience in World War I, specifically, the Battle of the Somme.