It happens. The cause of foot slip must be complicated.
If you don't look where you put your foot, it may slip.
Contact area between foot and rock might not be adequate. More rubber you step on, the better it is. The way foot touches the rock also reflects how your psychology is. The more advanced a climber is, the more relaxed she is. Relaxed feet, hands and the whole body.
I think the foot slips because one is tense and the body posture is not in balance. Sure it is a general thing to say.
There is a lot happening while you climb. Your forearm gets pumped because of isometric contraction and it prevents blood flow. Your control of breathing relaxes overall nervous state and thereby encourages your body to be in balance and overall awareness of your body.
First one should do when one needs to focus or pumped or panic. It is to relax and breath deeply to relax your nervous system so your awareness increases.
Foot slip is just symptomatic of the imbalance.