Unfortunately, the answer is yes. A stroke can effect the neural control over sexual function and erection.
The good news is that, if your stroke was recent, this function may improve with time. Usually, stroke victims continue to have symptomatic improvement from anywhere between 6-24 months after the stroke. Also, you should ask your primary care physician if you can safely take an erection medication such as sildenafil or tadalafil (Viagra or Cialis).