Would the only way to make sure it never looses the keyboard is to hook the keyboard to the POS application only?
This may not be a good idea. What if you need to perform some maintenance activities on the POS machine?

The best idea would be to see what is actually happening on the specific POS terminal. POS systems are prime targets for hackers, and the symptoms you are describing may be the result of a compromise on that PC. It could also be some sort of hardware issue or failure. An accurate diagnosis of the problem would be the best plan.