Could having sex cause asthma attacks?

Yes. The good news is, as with any exercise-triggered asthma, a puff of bronchodilator beforehand will usually prevent an attack from happening. Appropriate maintenance medication is also important at all times.
Can... Any strenuous activity can lead to an asthma attack, including sexual intercourse. Controlling your asthma symptoms prior to sex will help. Talk to your physicain about the appropriate therapy for you.