Dogs bark as a way of vocal communication. It could bark out of curiosity, to warn others of danger, keeping threats or intruders away, keeping their young in line or even signaling to you that it wants to play!
Barking for communicating other wants is possible. For example, a dog may learn to bark if it wants attention or seek a reward. Unchecked, it may become a problem in the long run. You can curb this issue by giving positive reinforcements to your dog when it becomes quiet. Do not give in to your dog when it demands attention for issues that have little cause for concern.
Be patient and consistent with how you condition and provide positive reinforcement to your dog to correct its behavior.