It depends on what kind of sock it is
You need to take your dog to a Vet as soon as possible. The sock can get lodged in his intestinal tract and cause a blockage that wont allow food to pass through. It could be life threatening if you don't take him to the vet. I hope he will be alright.
You'll have to strain his poop until it passes.