She doesn't understand that she is supposed to go outside yet, you just need to explain this in a way she can understand, and enforce it consistently in a way that will make her feel happy and confident about doing it your way.
When I am house training adult rescue dogs, I usually keep the dog on lead in the house for a few days. It's a pain, but it means the dog cannot slip away and get it wrong, if she starts to sniff or squat, you'll see it.
I also take the dog outside at least once an hour, give her time outside which isn't ball games or exciting stuff, just hanging about. Usually a dog with nothing much to do will pee before too long. Then you can praise her for getting it right, and maybe reward her with a ball game or treat.
Once she has the general idea you can let her off the lead in the house, but continue to supervise closely and pop her outside regularly. Over time, she'll form a routine and will probably begin to ask to go out if she needs to.