In case of divorce, be it raj`i (revocable) or ba’in (irrevocable), the wife must spend a period called `iddah during which she must stay in the marital home. She must never desert that house nor does her husband has a right to drive her out of it. This is based on Allah’s saying: “O Prophet! When ye (men) put away women, put them away for their (legal) period and reckon the period, and keep your duty to Allah, your Lord. Expel them not from their houses nor let them go forth unless they commit open immorality. Such are the limits (imposed by) Allah; and whosoever transgresseth Allah’s limits, he verily wrongeth his soul. Thou knowest not: it may be that Allah will afterward bring some new thing to pass.” (At-Talaq: 1)
Thus, during that period (which implies the continuation of marriage), the wife must stay in the marital home. The wisdom behind that is to provide an opportunity for the spouses to re-tie the knot legally. However, if that period elapses, the wife must leave the house.
The wife gains the right of child custody until she gets married, then that right is passed on to her mother then to her mother in-law then to the husband.
Finally, since the preparation of the marital home is the duty of the husband, then divorce does not render the husband forsaking the marital home.