Take a square, divide it in four and connect the centres of each of these squares without the connecting lines crossing. (There is only one possible pattern that can be generated when doing this.) Divide each of the previous four squares into four and repeat the connection of the centres, as before, this time modifying the previous pattern to include these new connections in the process. Repeat ad infinitum.
The following diagram is perhaps more explanatory.
(From Wikipedia: Hilbert Curve where the process is also animated.)
The process is also possible in three dimensions. Here is a screenshot from Hideyuki Hotta's web page at the University of Tokyo, where an animated 3D Hilbert space-filling curve can be seen. (Of course, mathematically, one does not have to stop at just three dimensions.)