If you are ordered by a court to give a portion of your 401(k) to a former spouse or dependent through a QDRO, the early withdrawal penalty does not apply.