Several localities throughout the country have laws mandating that animals in shelters be spayed or neutered prior to redemption by their guardians. The provisions of the laws differ. You should check with your municipality regarding the law in your particular community. Most importantly, you should consider that shelters are filled with homeless animals. Spaying/neutering not only provides health benefits to animals, but also helps to reduce the tragic overpopulation of dogs and cats.
Also worth noting is that many states have laws requiring shelters to either sterilize dogs and cats prior to adoption, or requiring the adopter to agree to spaying and neutering. Again, check with your locality to ascertain the local laws in your area since the local laws often are more stringent than state laws. Regardless of the law, your dog should be neutered unless a veterinarian determines that because of a medical reason, the life of your dog would be endangered by sterilization.