
The sonic fence was first seen in
"Par Avion".
Locke,
Kate,
Sayid,
Rousseau, and
Mikhail come to it. Mikhail says that it is a defense system that hasn't worked in years. Locke grabs Mikhail, and throws him into it. Mikhail says "Thank You", then a loud magnetic noise is heard. Foam starts coming out of his mouth, and then blood comes out of his ears. He then falls to the ground, seemingly dead. The rest manage to climb over the sonic fence. Sayid said Mikhail suffered a cerebral hemorrhage.
Later, in
"Left Behind",
Kate and
Juliet are running away from t
he smoke monster. They get to the fence, and Kate says not to run into it. Juliet says that the fence is off. She runs across it safely. Kate follows her. Juliet turns it on just as the smoke monster arrives. The smoke monster hits the fence, but cannot get through. It finally goes away. Juliet says that the monster does not like the fence.

Later in
"D.O.C.", we find out that Mikhail never died. He said that the fence was not set to a lethal level.
In
"The Man Behind the Curtain", young
Ben discovers the fence after running away from his drunken father,
Roger. He goes back there another day with the code to turn it off. He then made the bunny he had go first to make sure it was off.
In "The Shape of Things to Come",
Alex is forced to turn of the fence by the mercenaries. She enters the code
16 23, which triggers a warning system. When
Locke picked up the ringing phone, a voice was repeating Code 14-J.
In the first season in
"The Moth", the sonic fence is seen briefly in the background.
Questions: - Why was the fence built?
- Why can't the Monster go through it?
Theories: - The sonic fence was built to protect Dharma from the hostiles. In "The Man Behind the Curtain", Dr.Candle, the man in the video said that it was built to protect them from the wildlife. There is not much wildlife that would be threatening to people on the island. The polar bears would be in their cages on the other island. It would be silly to build a fence that to protect themselves from boars. It is logical, considering that the hostiles wanted Dharma dead.
- If Dharma did not create the smoke monster or if they did, it could have been used to protect them from that.
_____________________________________________________________________
This is a wiki of the Lost TV show