Surely, Company A will rightfully terminate the employee.
If Company A terminates the employee for also working full time at Company B, this is likely to be wrongful conduct by Company A, although the analysis is complicated and the stakes are relatively low.
It isn't illegal to work two full time jobs, unless an employment contract provides that the employee's full efforts will be devoted to the job, which is rare except in the case of senior executives.
While the analysis under the Fair Labor Standards Act (which regulates minimum wages and overtime pay at the federal level), and the parallel Illinois state law on the subject, is somewhat involved, it is probably illegal to have a "full efforts" clause in an employment contract for a full time hourly worker who is not exempt from overtime pay requirements under the FLSA and state law. Many remote workers are not exempt from overtime pay requirements (even in the tech industry). The federal FSLA exemptions from overtime pay requirements which are important in relation to dual-timing, are described here. State limitations on exemptions from overtime are often more constraining on employers but I haven't independently reviewed if this is case in Illinois.
Most employees of U.S. based companies are employees at will and can be fired at any time for any reason.
Thus, outside of a unionized employer or a civil service employment situation, a wrongfully fired employee can't be reinstated. And, unless the employee is fired for a discriminatory reason or for something like trying to organize a union, the employee is not allowed to sue the employer for money damages arising from a wrongful termination. (A handful of states are exceptions: Montana requires that terminations of employment be for good cause in most circumstances. Colorado authorized limited remedies when an employee is fired for lawful conduct while away from work like smoking. Many states authorize wrongful termination lawsuits for very narrow reasons like firing someone for taking legally mandated time off to vote in a Presidential election. New York City is atypical in many respects.)
The only distinction in a state like Illinois between a termination for good cause and a termination of employment without good cause, is eligibility for unemployment benefits. Someone who quits or is terminated for good cause isn't eligible for unemployment benefits. But, someone who is not terminated for good cause (either in a layoff or for some wrongful reason) is entitled to unemployment benefits.
As a general rule, for unemployment insurance benefits purposes, working two full time jobs is not good cause to terminate an employee's employment (unless you affirmatively lied to your employer and said you were only working one job, in which case the good cause for termination is dishonesty and not just working two jobs at once).
But there would be exceptions to the general rule if there was an exclusivity clause in an employment contract, if there was a non-competition clause in the employment agreement and it identified Company B as a competitor of Company A, or if there was a common law duty of loyalty of the employee and Companies A and B were competitors.
These are low stakes fights, however. You have to have worked for an employer for a certain amount of time to be eligible for unemployment insurance benefits at all. Unemployment benefits are limited in duration and amount (a percentage of past wages with a fairly modest maximum benefit cap) and continued receipt of benefits requires active efforts to find new work which are communicates to the unemployment office. A claim that pays benefits doesn't directly impact the bottom line of the employer. But the unemployment insurance premium rates of employers who have lots of successful claims made against them go up a little (although usually less in the aggregate than the amount of claims paid on those successful claims).
An overview of the unemployment insurance system in Illinois can be found here.
To be clear, Company A could terminate the employee in this situation and would face only very limited consequences for doing so. But, (1) usually any "full efforts" clause in the employee's employment contract would be invalid, and (2) the employee would not be considered "terminated for good cause" for unemployment insurance benefits purposes if this happened (which would be likely to cause Company A's unemployment insurance premium to go up prospectively).
Also to be clear, simply contacting Company B with no intent to cause a termination of employment and not saying anything untruthful, that does not result in the employee's termination by Company A or by Company B, is not wrongful in any way. The First Amendment privileges truthful, non-tortious communication from liability.
Can Company A legally contact Company B to inform them that the
employee has been working at both companies, resulting in dual
termination?
Yes.
Any laws that would prevent a company from doing this?
No.
Does it changed anything if the companies are headquartered in a
different state?
No (with the possible exception of New York City based firms in some circumstances similar to this, although perhaps not exactly the same, I have some vague recollection of a NYC specific employment ordinance related to a similar fact pattern, but can't find a citation to it at this time).
Other Similar Fact Patterns
Defamation
If Company A calls Company B and tells Company B something false (e.g. that you falsified records when it had no reason to think that was true) that causes you to be fired at Company B, the fired employee could probably sue Company A (and could also personally sue the Company A employee who made the statement) for defamation with damages equal to the wages lost from being fired by Company B.
Tortious Interference
If Company A calls Company B and knowing that you have an employment contract with Company B tries to get you fired from Company B, in some circumstances this could constitute actionable tortious interference with contract (i.e. this is something that the employee could sue Company A over). Indeed, this business tort originally emerged from employee poaching cases which have some similarities to the question in this case. As explained at the link above:
Tortious interference with contract rights can occur when one party
persuades another to breach its contract with a third party (e.g.,
using blackmail, threats, influence, etc.) or where someone knowingly
interferes with a contractor's ability to perform his contractual
obligations, preventing the client from receiving the services or
goods promised (e.g., by refusing to deliver goods). The tortfeasor is
the person who interferes with the contractual relationship between
others. When a tortfeasor is aware of an existing contract and
deliberately induces a breach by one of the contract holders, it is
termed "tortious inducement of breach of contract."
But, the full scope of when there is intentional interference with contract liability is beyond the scope of this answer.
The most famous recent tortious interference with contract case in recent memory involved allegations that Taylor Swift caused a Denver DJ whom she alleged groped women to lose his job (a jury ruled in her favor on the claim following a federal court trial).
Many companies, as a matter of policy, avoid making calls like the one described in the question, in part, to avoid potential defamation or tortious interference with contract liability.