It happens because he is young and healthy, and our bodies are programmed to have the strongest hormone flows when we're young and healthy. It's troublesome that he doesn't want to be friends because of this, I am sorry his faith makes him ashamed of something that is simply biological. Many men are most stimulated sexually when they are talking about love, just as many women are. (Again, the emotions are programmed by our biology.) If you can, tell him that getting an erection is just part of life, and you still want to be his friend.
i'm female
he said when we talk about love
So if I'm understanding you, you have a friend who is male and when you both talk he gets an erection. Are you male or female? And does this happen only when he talks to you, or just in general?