Driftwood can serve a number of functions in an aquarium. While most people think of it as a decoration, it also can provide a food source and encourage ideal water parameters for certain fish. Its important to understand these ancillary purposes of driftwood when deciding if it's right for your tank.
Food
Some species of catfish have adapted to feeding on driftwood. The common pleco has a mouth specially adapted to scraping off small amounts of driftwood. This provides nutrients, like lignin and cellulose, which can improve digestion for these fish. Typically, they eat so little it doesn't cause visible damage to the wood. Different plecos eat driftwood with varying degrees of enthusiasm. Some almost need it, while others would rather eat algae instead.
Water Chemistry
Driftwood also can alter water chemistry. Depending on what species of fish you have in the tank, this can be a good thing or a bad thing. Some fish, like those from the Amazon river, are used to soft water with a low pH. For them, Malaysian driftwood and African mopani wood are good decorations, since these woods contain chemicals that lower the pH and make it more like their home waters. However, some fish, like Rift Valley cichlids, prefer hard, alkaline water. For these fish, avoid driftwoods that lower pH, or avoid driftwood all together.
Hiding Places
Many fish need hiding places in their aquarium to feel secure. Paradoxically, many fish will stay out in the open more in an aquarium with lots of hiding places. Such tanks make fish feel safe and less likely to hide in the recesses of an aquarium. Driftwood, with gnarled, twisted shapes can provide lots of natural-looking hiding places for fish.
Aesthetics
Driftwood has several aesthetic benefits. The famous -- within aquarium circles at least -- aquarium hobbyist, Takashi Amano's "Nature Aquariums" frequently features driftwood as a key design feature. Driftwood can help a tank more closely resemble a riverbank and other natural environments. Additionally, the tannins from certain driftwoods can darken the water and give it a reddish shade. Some aquarium hobbyists like this "blackwater" aesthetic, though some feel it makes the water look discolored.