Slings are used to support the firearm when the shooter is not shooting. It is typically hung over the shoulder, and the sling pulled slightly so the firearm does not move too freely.
They can also be used to help stabilize the firearm when shooting; the sling is wrapped around the forearm, allowing the shooter to pull the firearm's stock into the pocket of the shoulder, allowing for more stability. The shooter must be careful to not wrap the sling too tight, circulation will be cut off and stability will be compromised, negatively affecting accuracy.
Slings are also used for weapon retention in combat situations. It is much harder to take a weapon away from someone properly employing a weapon with a sling than someone who is not using a sling.