To put the above informal discussion of braid groups on firm ground, one needs to use the homotopy concept of algebraic topology, defining braid groups as fundamental groups of a configuration space.
Alternatively, one can define the braid group purely algebraically via the braid relations, keeping the pictures in mind only to guide the intuition.