Which came first? The Black Smoke or The Sonic Fence? Perhaps at first it appears there is a simple, straightforward answer to this conundrum. However, digging into the matter throws up some intriguing elements - but first some groundwork.
The Sonic Fence is impressive. It surrounds The Barracks in a wide perimeter. The pylons were constructed and spaced evenly apart with absolute precision. Weak links, after all, would counter the whole purpose of the fence. Construction was no mean feat and that's without taking into the account the technology developed for it; a continuous stream of high-frequency soundwaves channelled through each pylon to produce a seamless barrier between them. The Sonic Fence was not something quickly whipped up; it took a lot of planning, development and effort. I don't believe that is insignificant.
The purpose of The Sonic Fence is twofold. The obvious purpose is to keep things on the outside from getting in. This makes The Barracks a protected environment in which to teach schoolchildren and allow the Dharma Initative people to sleep soundly in their beds. The alternate purpose of The Sonic Fence, however, is that it also keeps people in. There is an ever-changing access code requirement and such information can easily be limited or repressed dependent on how much freedom people were granted.
To put it bluntly, people Dharma didn't want wandering the Island could be contained. To put it bluntly, The Sonic Fences' protection also served as a prison. Typical of Dharma to keep things on a need-to-know, privileged basis.
The Barracks Orientation Video (as Narrated by Marvin Candle) - "For your own comfort and safety, we ask that you stay within the confines of your new living quarters. Our barracks are surrounded by a high frequency sonar fence to protect us from the island’s abundant and diverse wildlife. You are now a member of the DHARMA initiative. Every morning you will be given a new code that will allow you to cross outside the fences if you so desire. There are properties on this island that exist nowhere else on earth."
So let's get to the meat of the matter. What was The Sonic Fence for? If it was just to keep out "wildlife" then a high electric fence would have done the trick. As it stands, The Sonic Fence is actually hazardous. Given there were children in the Dharma Initiative the invisible barrier is very dangerous. Too easily could some errant child have unsuspectingly wandered through the barrier (they can't see it, and it makes no sound) to their frothing-mouthed death (provided it was set to a lethal level, which it presumably wasn't on a regular basis but that doesn't discount the harm caused by non-lethal settings - just ask Mikhail!). Evidently, the Dharma Initiative considered such ricks acceptable.
Let's consider the 'happy coincidence' idea. Basically, that the Dharma Initiative constructed The Sonic Fence for one purpose - to keep out "wildlife" - only for it just so happening to be ideally suited to preventing the Black Smoke from getting through. The Dharma Initiative were involved in all kinds of zoological research, who knows what weird and wonderful developments were running wild in the jungle? (I'm thinking Hurleybird.) But what kind of "wildlife", no matter how unnaturally developed, could possibly require a Sonic Fence to keep them out rather than a regular, electric fence? It all seems strikingly unlikely, and so having considered the 'happy coincidence' idea I have to dismiss it.
The Sonic Fence must have been purpose built to keep the Black Smoke out. This is a point that leads to two possibilities. The first possibility is that the Dharma Initiative arrived on the Island, started conducting scientific studies, and encountered the Black Smoke. What I mean is, the Black Smoke was on the Island before they were. Thus the Dharma Initiative somehow discovered enough about the Black Smoke to understand that a Sonic Fence would be adequate defence against it and so built one to protect themselves.
Problematically, as already established, The Sonic Fence was no mean feat to construct. It was a heck of an undertaking! Couple in the matter of 'investigating' the Black Smoke to work out the precise nature of what type of fence would be required and that seems like a roundabout, elaborate explanation. Not unfeasible, mind, just less likely than the alternate rationale.
The alternate idea is that the Dharma Initiative knew they needed a SonicFence precisely as they constructed it because they knew all about the Black Smoke. What I am suggesting is the Dharma Initiative (either deliberately, or as a nasty side-effect of a different study) were responsible for the creation of the Black Smoke. This makes the most sense to me. Before you do an experiment with dangerous chemicals you put goggles over your eyes because you're aware of what happens if you don't. Precaution fitting the risk. The Sonic Fence just seems too perfectly well-designed to repel the Black Smoke for Dharma to have not known a lot about it. That's my gut feeling.
Of course, when Ben was asked by Locke during Confirmed Dead about what 'the monster' was he earnestly replied, "I don't know." And don't forget Juliet's remark to Kate during Left Behind: "We don't know what it is but we know it doesn't like our fences." Only when Juliet says "we" she means The Others. And when Ben says he doesn't know he might be lying, or he simply may have been a member of the Dharma Initiative that was not privileged to know about the Black Smoke. Certain select members of the Dharma Initative knew of the Black Smoke and where it had come from, and they've either left the Island and kept their mouths shut or, more likely, they were killed in The Purge and the secret died with them. Typical of Dharma to keep things on a need-to-know basis. . .