The old saying about keeping your eye on the ball was actually a cue some instructors used to help golfers maintain their shoulder tilt from setup through impact. Unfortunately, it has been misinterpreted over the years to mean you should keep your head down and dead still when you swing. Doing that leads to a restricted motion back and through—and poor shots.
So what should your head be doing? Well, it's a bit of personal preference. Jack Nicklaus liked to tilt his head away from the target before taking the club back, like he was staring at the ball with his left eye only. That allowed him to make a freer backswing. Other players, like Annika Sorenstam, let their heads rotate toward the target during the downswing to help them power through the ball. Curtis Strange let his head move laterally in both directions—away from the target going back, toward the target going through. Those can all work.
The most important thing is to keep your head from bobbing up and down. If it does, you have to return it to the level it was at address to make solid contact. That's tough to do consistently. Remember, it's OK to slide or swivel your head—just maintain your height.
Several years ago Golf Digest ran photos of my swing from 1980 and 2009. What it showed was that although some aspects of my swing had changed, my head moved the same way. I let it rotate a little away from the target in the backswing and a little toward the target in the downswing. I still do today (above).