Hi Missing Buddy,
It's a bit of a phenomenon but it does happen. There is a condition called Situational Erectile Dysfunction that affects younger men. They can perform when they masterbate, but have difficulty achieving an erection with their significant others and wives. You can read more about Situational ED here.
Online sites are great for getting the information to ask all the right questions but it can not take the place of a doctor's solid advice. If you think there is something that might be physiological, it might be best to encourage your man to go to the doctor.
Good luck and let us know how you are doing!
We hope you find this general health information helpful. Please note however, that this Q&A is meant to support not replace the professional medical advice you receive from your doctor. No information in the Answers above is intended to diagnose or treat any condition. The views expressed in the Answers above belong to the individuals who posted them and do not necessarily reflect the views of Remedy Health Media. Remedy Health Media does not review or edit content posted by our community members, but reserves the right to remove any material it deems inappropriate.