Many fish come from areas where there are a lot of rocks. Many of these fish use the rocks for shelter, reproduction, and harvesting food. Most of the African rift lake cichlids seen in the hobby today live in areas of the lakes that have large rocky reefs. These fish use the rocks for shelter and spawning surface to deposit their eggs. Many of the fish eat algae that grow on the rocks. Many cichlids from Central America are also adapted to an environment that has a lot of rocks. Riverbed rocks are an excellent decor for these types of fish.
Many cichlids, like oscars (Astronotus ocellatus), Jack Dempseys (Rocio octofasciata), rainbow cichlid (Herotilapia multispinosa), dwarf flag cichlids (Laetacara curviceps), and rams (Mikrogeophagus ramierzi) will use a flat rock as a spawning surface.
Rocks can be purchased from rock/landscape suppliers or aquarium and pet shops. They can also be collected at many different locations at no cost. Most rocks are neutral, but some made of calcium carbonate will affect pH and hardness of the aquarium. Typically you will only need to scrub the rocks with a brush and tap water before placing them in the aquarium.
If you plan on stacking rocks in the aquarium, you should place them in contact with the bottom of the aquarium, so that if a fish digs, the rocks will not shift and tumble, possibly breaking the glass.
Rocks will eventually become colonized by aerobic bacteria. Rocks in an established aquarium can be used to help seed new aquarium setups with beneficial bacteria. The technique of moving rock to a new aquarium will often prevent the new aquarium from having an ammonia and nitrite spike.