If one of the target creatures becomes an illegal target while Soulmates is on the stack, Soulmates resolves but doesn’t enter the battlefield because its enchant ability won’t be satisfied. If both targets are illegal, it doesn’t resolve at all. In both of these cases, it’s put directly into its owner’s graveyard from the stack.