You catch them through close contact with someone carrying them already, they can jump between heads, lay their eggs and then their eggs hatch, you then pass them on to someone else etc etc. That's why there are often outbreaks in primary schools!
But can headlice breathe underwater? Because if they can't then surely you can just immerse your scalp in water (e.g. when you're lying in the bath) and they would all drown.