In S1E19 "Deus Ex Machina", Locke was struggling to find a way to open the hatch and asked for a sign. He dreamed of seeing a small plane about to crash on the island. Upon awakening, he relays his dream to Boone and the two of them set off into the jungle in search of the plane.
After discovering a set of rosary beads in a tree and the skeletal remains of what resembles a priest carrying a large wad of Nigerian naira and guns, they continue their hunt for the mysterious plane from the dream. They finally come across a yellow Beechcraft perched high in the canopy of the jungle.
Because of Locke's earlier leg injury, and the fact that he was beginning to once again lose the use of his legs, Boone climbs up into the plane. Boone discovers maps, and heroin filled statues of the Virgin Mary, and becomes angry that Locke's 'sign' is indeed a drug smuggling plane. Boone discovers a radio in the cockpit and uses it to make a frantic mayday call that is answered mysteriously, by Bernard, someone we later learn is another survivor of Flight 815, and living on the other side of the island. The Beechcraft falls out of the tree and flips, leaving Boone with injuries that ultimately lead to his death. Charlie and Sayid stumble onto the Beechcraft, and the heroin in S1E24 "Exodus Part 2", while attempting to rescue Claire's baby from Danielle. We discover at the end of that episode that Charlie has taken one of the drug filled statues.
The mystery of where the Beechcraft originated remained unsolved until S2E10 "The 23rd Psalm". We learned that in Nigeria, Mr. Eko had been a drug lord and needed a way to transport heroin out of his country. He approached his brother Yemi, a priest, about using one of the Catholic missionary planes to smuggle the drugs out of the country hidden inside 300 Virgin Mary statues. When Yemi refuses, Eko blackmails him into signing papers disguising Eko and his henchmen priests, so they can board the flight.
As Eko and his gang are loading the drugs onto the plane, Yemi attempts to stop him from leaving when he is inadvertently shot by the military. Yemi is pulled on board the plane as it is leaving, leaving Eko behind to assume Yemi's identity as a priest.
After discovering that Charlie possesses one of the statues, Eko demands that Charlie take him to the crash site, and discovers the Beechcraft containing the body of his brother Yemi. After saying a prayer over his brother's body, Eko and Charlie burn the plane and its contents.
Although the mystery of the Beechcraft's origin has been solved, it is still unknown how the plane came to crash on the island.