In general dogs bark for many reasons.
No doubt as Ozzy Tek mentioned, dogs bark to communicate with each other.
They also bark when they feel threatened, when they are scared, when they feel anxious and especially when they want to induce "playtime" with another dog.
Some bark to ask their owners to let them in.