Vet at FirstVet answers:
When a dog suddenly starts peeing inside you have to find out if it is because it is unaware of it (= is incontinent) or if the dog is actively sitting and urinating as it would normally do outside. If a dog is incontinent an examination of the urinary tract with ultrasound and a neurological examination (assessing different reflexes) will be required in order to find a cause.
A common reason why spayed bitches become incontinent is because the musculature in the urethra loses its strength, resulting in urinary incontinence. This can be treated with medication.
If a dog actively urinates inside it can be due to a urinary tract infection, be secondary to another disease, or a result of a change in behaviour. If there is no physical cause found, help from an ethologist, a behaviour specialist, may be required.