"Keeping at bay" or "holding at bay" can also mean "keeping something from escaping." So the idiom can be used to mean different things, but all of its meanings and uses have to do with hunting. In a way, the way the idiom is used depends on who is using it. If a pursuer is using it, it can mean to prevent something from escaping. If the person who is being pursued is using it, then it can mean keeping something away.