Very easy to fix by inserting a screw through the dowel. These are my stall bars. Note that I drilled holes completely through the sides so I could remove dowels or take the whole thing apart. If your stall bars look like this, you can insert a screw from behind, aim right in the middle of the width, and you'll go thru the dowel. If you can't see the dowel from the side, you'll need to move your insertion point from exactly the middle to slightly more to the inside.
Get yourself these exact screws from Home Depot. If you don't live in the US, get similar length screws, preferably self-drilling, self-tapping.
Here's a closeup from behind so you can see how the screws are inserted from back to front, through each dowel. This is a solid hold and the dowels don't move.
Here's the same-length screw so you can see how deep it goes...all the way through the dowel.
I'd suggest you carefully drill a hole with a drill bit a little more narrow than the screw. This will help the screw enter exactly where you want it to go. The screw is self-drilling, so you don't need to drill more than just into the back of the wood. If you need to practice before you do this (like I always do when I try something new), buy a 2x4 and drill some practice holes in the edge.