Hello.
This is a good question indeed.
Your concerns are important in terms of your outlook towards your relationship with your husband.
There are various stages of sleep. One such stage is called the REM (Rapid Eye Movement) stage. During this stage, the brain works overtime while the rest of the body is relaxed. But it is during this stage that a man get's an erection. And during the entire night sleep, one may get REM stages every hour or so. And during each REM stage, erection is observed.
A person may or may not be dreaming in the REM stage. And when they are dreaming, it may or may not be of a sexual nature. But regardless of what dream it is, there will be an erection.
I think you should discuss this with your husband and perhaps both of you could together find some more information on this topic from a doctor or from the internet, but from authentic source. This will help you clear any suspicions that have crept in to your relationship.
Regards
This post is for the purpose of providing medical information and is not a substitute for a face-to-face consultation with a doctor. This post is not intended to give or rule out a diagnosis, create a doctor-patient relationship or replace an existing one.