No, technically speaking, not all railings need a top rail. For example, post-free glass railings are often designed to be as inconspicuous as possible and therefore often lack a top rail.
However, it is important that the railing’s design and choice of materials (such as glass thickness) are sized to meet safety requirements even without the additional stability provided by a crossbar.

