Sloths are dependent upon their environment, but that environment is also dependent on the sloth. There is the obvious factor that plants produce oxygen while animals produce carbon dioxide, but this is just a minor detail that would be true in any environment and there are other more important ways in which they work together.
It is thought that the trees in which sloths spend almost their entire lives in are significantly helped by the sloth's presence. Since sloths come down to the base of their tree to defecate, this provides the tree with a form of fertilizer to help with growth (Apostolopoulos, 2010). Being that sloths are solitary animals indicates that many trees most likely get this source of nutrition. In addition, sloths also help prune trees by eating the young leaves, because they are easier for the sloth to breakdown (Bullinger, 2009). Pruning a tree means that much of the new growth is removed so that the energy the tree produces can go to the existing branches and leaves.
Sloths provide the trees with enhanced growing conditions, but do the sloths benefit? Yes, the trees provide not only a place to sleep, but a safe place to live. Everything a sloth does, except defecate, is done in the trees, without them sloths would be extremely vulnerable to attacks by land dwelling animals (Apostolopoulos, 2010). Also, because sloths have poor control over their temperature, they need to be in the high branches of the trees to get direct sunlight to heat them up during cold times.
It has been said that in and of itself, a sloth's fur is like an ecosystem (A sloth and a moth, 1976). This is said because algae, beetles, moths, and mites can be found in the sloth's fur (Baker, 1997). Many people may wonder how algae growing in the fur of sloths is helpful to the sloth, but really this algae helps to turn the sloth's fur greener which helps it blend in with its surroundings (M.V. Verdi, April 4, 2012). This is only possible, however, because of the high rainfall of the rainforest, and the slow motion of the sloth of course. The moths, and probably other creatures, eat the algae and dead cells that are in the fur of the sloth (A sloth and a moth, 1976). This means that the small creatures are getting nutrients while the sloth is being regularly cleaned. In addition, the sloth's dung provides a place for the moth's larva to feed (Newman, 1990).