I know that with cats it is possible, indeed advisable in the case of unwanted litters, to spay a pregnant cat - effectively, abort the litter and spay the cat at the same time.
Ask your vet if same is possible with pregnant bitches.
If I may ask, why wasn't your bitch spayed already? As you have found out to your cost (and probably to the cost of your local pound/rescue), the only guaranteed way of ensuring your bitch won't get pregnant is to spay it. And while you're at it have a gentle word with your neighbours about neutering their beloved dog - male dogs in particular live longer and healthier lives if they have been neutered.
On the age question, check with your vet, however I would assume that as long as a bitch is able to bear a litter, she can and should be spayed!