Dividing retirement benefits with a soon-to-be ex-spouse is often one of the most emotional issues in a divorce. It is a prime issue for mediation. A recent article in the Wall Street Journal addressed some of the complexities of "qualified domestic relations orders" and how to best deal with them, and it is well worth reading.
In simple terms, a QDRO is a court order requiring a pension or 401K administrator to divide a spouse's retirement assets according to their agreement. The article discusses the importance of preparing the QDRO properly.