This could be because of anxiety. It is ok not to get erection sometimes but normally after such failure most of the men becomes so anxious that anxiety itself would start giving a problem in erection. You need to get relax and concentrate on foreplay. Enjoy togetherness and erection has to come if not today, tomorrow. Remember you are with wife and not with an outsider where present performance matters the most.