In addition to this layer of security, switches allow for a few nice things. They allow for ports of different speeds to be connected. They achieve this by having a relatively large packet buffer sitting on each port which can store some data. Switches also allow for Full Duplex operation. This means that computers can send out packets all at the same time without them colliding.
Collisions arise from having multiple interfaces send a packet at the same time.
They can be a real problem with hubs especially, since it means that no computer sitting on a hub can send a packet while another is sending. This is very similar to what routers do, and in fact is the same.