If a planet is in the process of being invaded and the invaded empire sends reinforcement fleets to it, the reinforcement fleets will get captured by the invading empire if invading transports reach the ground and win the ground battle after the invaded empire's fleets arrive but before they can reach and destroy the landing transports. The relative strengths of the invaders and reinforcements are irrelevant.
This doesn't make much logical sense from a gameplay perspective. Perversely, it makes it risky for players to try to actively defend planets being attacked, since they risk losing their own fleet to capture.
The fleets may not be visible in the invading empire's game client right after capture, the invader may have to refresh before they can see and use the captured fleets. The player from which the fleets were captured can see them immediately or on the next turn.