Working for free is legal in certain situations and illegal in others. In the situation you asked about, it is illegal because the worker normally gets paid for the same job they would be working for free. Other situations are legal; for instance, say you work at a law firm and your boss wants you to come up with a writing sample. He could ask you to work on something like this without pay. 
Another situation to keep in mind is training. In most situations, employers must legally pay their employees for training. If they do not, they could potentially be setting themselves up for a lawsuit.