Is it legal for a US professor to require remuneration from the foreigner for consulting services?
It is not illegal to do legal work for money.  It may, however, fall outside of your institution's employment policies, and you might get yourself in a bind with your employer.

Consulting arrangements are generally laid out in your university's policies, and are often fine (but ask at your site!).  That said, I'll delve a little deeper into your question.  It is unusual for a "student or postdoc" to request the professional consulting services of faculty members, and thus you must consider what you are being asked to do.  If you are being asked to help the student cheat -- i.e., the student is planning on representing your work as something otherwise, you should take absolutely no part in it.  If it's something central to the students project, and you are being brought in as a contractor and not a collaborator, you might consider avoiding it.

The fact that the party is foreign is not germane.