A cot side or bed guard rail is a raised side fitted to a bed to stop the occupant from falling out of bed. They occur:
In toddler beds; however in infant beds the sides are to prevent intentional, rather than accidental, exit.
In normal beds, where the occupant temporarily (due to age or infirmary) cannot be relied on exiting the bed safely.
In hospitals where a patient cannot be trusted to stay in bed. Here they are detachable.
On board small craft (e.g. trawlers) to stop the occupant from rolling out of bed when the boat rolls in heavy weather. Here they are fixed, and lower than the hospital variety.