From my experience:
I had a defensive pact with America, Egypt, India, and England. England was attacked (by the French). I was notified that I had declared war on France, and all my defensive pacts were cancelled.
Whenever you declare war on anyone (whether automatically via pact obligation or manually), your defensive pacts are cancelled. But, as someone already pointed out, they've already served their purpose, and you can re-sign them as soon as you are at peace again.
But, all this only really made sense to me after I looked at the log. All those declarations and pact cancellations flew by so fast that I was sitting there for a few seconds saying: "Okay, what the heck just happened." It was actually quite cool.
It goes like this:
1. Your defenseive pact partner is attacked.
2. You automatically declare war on aggressor
3. All your defensive pacts are cancelled (even with the partner who was attacked).
Similar things happen when you are the one attacked. I'm not sure the log gets the chronology right every time, but the end result is the same.
Finally, the real interesting question is how the AI takes defensive pacts into account. . . if it does at all. I would like to think that the AI would consider the military might of allies before calculating whether to go to war. But, I'm not sure it does, since France's decision above was monumentally stupid and suicidal. I travelled halfway across a huge map (marathon game) with transports full of modern armor to wipe the map clear of them. . . all to honor my pledge to the English.
Have I mentioned that I love this game?
H