Since you repeatedly used the term "company", I presume that both the companies are registered under the Companies Act,1956. As such they are separate legal entities though the directors are the same persons. Therefore, unless there is an agreement between the two companies regarding inter company transfer of employees with continuity of service and provision for same or similar conditions of service, you can not effect transfer of any employee in between them.
In the described situation what you can do to avoid future problems in this regard is to obtain the resignation of the employee from the first company and settle his F&F and issue a fresh offer and appointment orders from the second one.
22nd March 2018 From India, Salem