Do I need a stud on each side to install a swinging shower door?
You may be OK if you use proper anchors. I assume this is drywall. The shower door shouldn't be that heavy but you certainly don't want a bunch of glass raining down on someone. It would probably be a good idea to put a stud if you still don't feel the anchors will work for you.