Just like people, dogs can become hoarse if they overuse their vocal cords.
If your dog has been barking for extended periods, this could be the case.
While you should still make an appointment with your vet, in most cases rest is the recommended course of treatment.