Could be late onset diabetes, my 10 year old American Eskimo started wetting herself walking around the house, eating her meals, laying in bed just peeing all the time. I took her to the vet and turns out it's diabetes got her in the insulin and she stopped peeing for no reason.
First and most important, he needs to see the vet. Your dog is a senior citizen now, and the problem could be something as simple as loss of tone in the bladder and muscles that control urine, to a urinary tract infection to the beginnings of kidney failure. He can't help it, and certainly isn't doing it on purpose, so don't try to discipline him when he has an accident.
Bring along a urine sample when you take him to see your vet. It's easy to get the sample too. Just pop a plastic cup underneath him as soon as he starts to go. Try to get the first morning's urine if possible, and if you can't get the sample to the vet in about an hour, store it in the refrigerator until you can get it there. Your vet should run some basic blood work to find out exactly what is going on, so don't be surprised if that is part of your visit. Any senior dog should have this kind of lab work done annually so that you can catch problems early enough to treat them. Hopefully your dog has something easily treated, but if he's in kidney failure, there are still things you can do to keep him more comfortable and cut down on the accidents.