Striking someone with a handgun is not an action to be taken lightly. It should only be done when you have no better alternative because doing so puts you at risk of losing your pistol to an assailant. It can also cause serious injury to the subject, especially if you strike him or her in the head. And it could discharge, if the jam clears with the impact.
A handgun strike is a desperate, last-ditch defensive measure, but nonetheless, it's one you should practice. If you haven't trained to perform this action, you won't be able to do it successfully when you need it.
You have to commit to this move. Awkwardness and tentativeness can result in disaster. You also have to be aware of weapon retention concerns before you make this strike. Dropping your gun or having it taken away are very real possibilities, and your trainer should discuss them with you.
The purpose of striking an assailant with your handgun is to stun or stop him or her. It's a delaying action intended to give you enough space between you and your attacker to clear your weapon malfunction or perform a reload and get back into the fight.
When teaching techniques and directing training drills using handguns (NOTE: For safety, use colored gun replicas such as a Blue Gun), your trainers should have you practice strikes from standing and ground positions. The best target area for these strikes is the head, which could disorient or knock out a suspect. As discussed before, head strikes can cause severe injury and even death, but remember you are already in a deadly force situation.