Candidate on the interview says "I have kids". It sounds like the candidate is bringing on a condition that the candidate considers as potentially having some relation to the proposed employment (otherwise why would the candidate mention it?). It is only reasonable for the interviewing person to ask how the candidate would manage the condition that the candidate brought on in a manner and situation that strongly suggests that the candidate may consider the condition as potentially related to the proposed employment.
Guy says "I have kids". No problem.
Woman says "I have kids". Problem.
Whether it's legal to ask or unnecessary to mention is irrelevant.