Hi shar7,
The need to go to the toilet during panic attacks is common - so called panic attacks are just the natural emergency response to a perceived threat -the fight or flight mechanism. Thousands of years ago, when man was often hunted, urinating/defecating would have been a useful response to make us less appealing to animals hunting us!
You can find out more about panic attacks and how to overcome them
Here.
Good luck.