From BlenderWiki

Making a tube

The "Extrude along path" technique is a very powerful modelling tool. It consists of creating a surface by sweeping a given profile along a given path (i.e. Bézier or NURBS curve). This simple example will sweep a Bézier circle along a Bézier curve to form a pipe.

Curve path

First we create a Bézier curve using the "Bézier Curve" menu item from the Toolbox's Add/Curve menu, see (Curve path).

Circle

Exit Edit mode using ⇆ Tab and create a Bézier circle using the "Bézier Circle" menu item from the Toolbox's Add/Curve menu, see (Circle). The default name assigned to the circle is "CurveCircle".

Extruded

Now select the path and enter the name of the new circle in the BevOb field in the Curves and Surface panel. This sets up the Bevel tool to reference the circle. But why Bevel? Extrusion is a form of beveling.

Once you enter the circle name into the BevOb field the extrusion, or beveling, begins immediately as shown in (Extruded). Notice that the extrusion doesn't follow the contour of the path exactly. This is because the control-points' geometric center is not at the same location as the path's first control-point.

Extrusion adjusted

Go ahead and select the circle and enter Edit mode. Make sure all the control-points are selected, (A) and enter Grab mode (G). Drag the control-points to the left, while holding the Ctrl key, until the circle is centered over the first control-point on the path curve, see (Extrusion adjusted).

Notice how the pipe begins to take on the contour of the path as you move the circle control-points closer to the first control-point on the path. If you had moved the circle in Object mode nothing would happen. This is because the extrusion is controlled by the position of the control-points relative to the object's center and you can't move the control-points while in Object mode. In other words the results of the extrusion is completely controlled by the control-points position and handles.

(Extrusion complete) is the what the extrusion looks like in solid mode. You can see that the pipe is hollow and round just like the circle used to form the surface.

Extrusion complete

This example is just one of an infinite number of ways to model using extrusion. For more detailed tutorial(s) that expand on the technique of extrusion see the Tutorials section on curves. There you will find tutorials that show more advanced methods of extrusion, including 3D curves.