Are you female? Does this happen at any other time when you wouldn't expect it? That condition is considered rather rare. It's possible when you start having a panic attack you start thinking of sexual arousal because sexual release is usually relaxing. It changes your focus, which also lessens anxiety at least for a time. There have been some people on here over the years reporting the urge to masturbate when getting panicky, and again, it make sense as sexual release is relaxing and does focus the attention very strongly elsewhere.