Yes, the Pokemon will always be legal, assuming that the parents did not have any illegal abilities or IV values. Moves don't make a difference as the offspring only inherits moves that it can learn via level up or by egg move, so it'll never inherit illegal move. I'm not sure how the game treats passing down illegal abilities and IVs (it may just revert them back to a legitimate one), but just in case, remember that if the mother (or the father if breeding with Ditto) has an illegal ability, it has an 80% chance of passing it to the baby. Likewise, if parents have illegal IVs, they may also be passed down as the baby inherits 3 IV values from either of its parents (5 if the Destiny Knot is held by either parent).
If the parent's stats, abilities, etc. are all legal but they were just obtained through a hack, the baby will be legal and should work fine. If that's the case, the parents should also work unless the game somehow determines that they're illegal.
Source for ability and IV passing chances