This sort of thing can happen from time to time for a variety of reasons. It isn't you; it isn't him. It might be due to stress, fatigue, etc. It's best to not make a big deal about it, but just move away from intercourse and give him a slow handjob or do something non-sexual.
Hi,
Have you tried more lubricant, additional foreplay, or different positions that may be more comfortable for you? Are you under any stress or feeling pressured? Stress can have an effect on involuntary muscle contractions making penetration nearly impossible; try to relax through deep breathing exercises during foreplay.
Good Luck