Hi there, I'm so sorry you needed to go to ER. I'm even more sorry you weren't listened to.
I'm not a medical doctor, but it sounds like he was testing you for BPPV (Benign paroxysmal positional vertigo). By moving your head back and forth, if you have BPPV, it often triggers the dizziness.
NOnetheless, he should have explained the procedure afterwards. Best of luck, and you can demand answers to why they are testing and what they are looking for.