How to keep objects on the terrain?
The Shrinkwrap modifier is probably what you're looking for. It has a mode called &quot;Project&quot; that will just translate the objects along one axis until it reaches the target.
You probably won't be able to use the Shrinkwrap modifier on the fences themselves, though. You'll probably have to create a strip of edges that goes on the ground where you want the fence to be (you can make it not renderable, so it doesn't show up). Then you'd use the Shrinkwrap on that to make it stick to the terrain. Then you'd use Dupliverts to make a fence piece on each vertex of that strip.
There may be a simpler solution. I hope this idea will get the creative juices flowing...
From the Manual on Shrinkwrap:

The Shrinkwrap modifier allows an object to “shrink” to the surface of another object. It moves each vertex of the object being modified to the closest position on the surface of the given mesh (using one of the three methods available).


From the Manual on Dupliverts:

Duplication Vertices or DupliVerts is the duplication of a base object at the location of the vertices of a mesh. In other words, when using DupliVerts on a mesh, an instance of the base object is placed on every vertex of the mesh.