As a baby, Harry Potter was in the room when Voldemort's fatal Killing Curse backfired. Voldemort's soul had been weakened and destabilized by his continuous murders and the creation of his previous Horcruxes. Harry became a Horcrux when a fragment of Voldemort's soul attached itself to him after the unsuccessful curse. The lightning bolt-shaped scar on Harry's forehead is a direct result of this attempted murder.
This connection is used to explain several important plot points. Throughout the series, Harry is able to receive insight into Voldemort's mental and emotional states, allowing the reader to eavesdrop on the series' primary antagonist. This insight is usually accompanied by pain in the scar on Harry's forehead. Through Voldemort, Harry also inherited the ability to speak and understand Parseltongue. It is also revealed by Rowling in an interview that Harry's frequent pain in his scar when Voldemort is either active, nearby or feeling strong emotions, is really the trapped bit of soul yearning to depart from Harry's body and rejoin its master soul.
While Voldemort did learn of Harry's telepathic ability, Voldemort was never made aware that Harry was inadvertently protecting a portion of his soul. When Voldemort attempted to kill Harry with the Killing Curse near the end of Harry Potter and the Deathly Hallows, he destroyed the portion of his own soul embedded within Harry. Once destroyed, the connections between the two were also broken, and Harry never again felt pain in his scar.