This has never happened to me but it could be that maybe you are thinking about the actual intercourse too much, like you are anticipating the action too much lol.
Try think of sex differently. try thinking of actually being with her and the foreplay and the little pillow talk and by the time she wet and ready, you should be rock solid lol. If that dont work then you need to book an appointment with you doctor.
P.s. Is this your first time? Muahahahahahahahaha. Nah seriously. maybe you're just scared. Relax and try and enjoy the WHOLE thing lol