These lines are a way to show the structure of a magnetic field. A compass needle will always point along a field line. The lines are close together where the magnetic force is strong, and spread out where it is weak.
Mathematical construction: a family of curves in space giving at each point the direction (by the tangent of the line) and the strength (by the local density of lines) of a magnetic field.
The trajectories along which magnetic particles would align, or charged particles would flow, if placed in a magnetic field.