I'm not 100% sure how the immigration law works but if you're an employee of a foreign corporation who comes to the US temporarily (90 days or less) and are paid less than $3000 you aren't considered to have been in a trade or business in this country and don't have to claim the money earned as US income. I don't know who Melania was working for when those pictured were taken but if she was an employee of a European company and came here just for the shoot and was paid less than $3k then she didn't violate tax law. My guess is that the tax law lines up with immigration law on this issue but I'm not sure.
She wasn't an employee. She was booking jobs through a Parisian modeling agency.
If she wanted to work in the US, she was supposed to get an H1B or similar visa. However, that lets you stay in the US for 3 years, and there is no need to go back to your own nation.
She explicitly stated that she went back to Slovenia every few months. The only visas that require the national to return to their nation are tourist visas, and you're not supposed to work in the US on a tourist visa.
Of course, it was (and probably still is) fairly common for models to do this, especially among agencies that were less scrupulous or less organized.
It's not a huge deal, but it is a violation of immigration law, and a tad hypocritical for Trump & the Trumpettes to take a hard line against illegal immigration, but give Trump a pass -- not just on this, but on using H1B's for Mar-A-Lago and similar Trump businesses, even while Trump proclaims he wants to stop H1Bs. It ties into a (slightly) larger narrative of "WTF."
That said, keep in mind that partisans are highly sensitive to hypocrisies by the other side, and very willing to cut people on their own side lots of slack for transgressions.