Question:
Answer:
The bottom line answer to your question is that an annulment has no effect whatsoever on the legitimacy or illegitimacy of the children born from a particular union. Children either are or are not illegitimate, regardless of whether an annulment is granted or not.
Most of the time, even when an annulment is granted, the children are still legitimate. This is because canon law specifies that “Children conceived or born of a valid or putative marriage are legitimate” (CIC 1137). “An invalid marriage is called putative if it has been celebrated in good faith by at least one of the parties, until both parties become certain of its nullity” (CIC 1061 §3). This means that as long as oneof the parties thought they were being married, all of the children born of that union will be legitimate.
The only way for invalid children to be born would be if neither party thought they were getting married (that is, both knew going in that the union was invalid) or if both at some point become certain that their union is invalid yet keep having children anyway. (In the latter case, the only illegitimate children would be those born after the point that both parties became certain.)
It is also possible, even when children have been born illegitimately that they can be rendered canonically legitimate (CIC 1139). This is possible because legitimacy is a legal rather than a moral concept. It is used in various law systems to determine such things as child support and inheritance rights, but it is no reflection on the child.