It seems like they would be useful...
For at least a couple of reasons:
The crew would be buttoned up inside the armored citadel of a cruiser or other ship during an action -- when you're flinging shells back and forth, the safest place to be is indoors. The railings aren't useful when no one's on deck.
The blast effect from the ship's guns could easily damage fittings like rails and stanchions if they weren't stowed away -- larger ships with larger guns sometimes had moderate to severe blast damage from the firing of the ship's own guns, and firing straight forward or aft (or across the deck for ships that had turrets on the quarter) could damage the decking.