Why is "did" before the subject to show emphasis?

Solution 1:

The basic sentence here would be: - This woman had a long memory.

With the emphatic 'do', it would be: - This woman did have a long memory.

The sentence you give here is actually using the verb 'do' as an auxiliary in the question structure, as happens in the present simple and past simple:

  • Do you own a car [right now]? [present simple]
  • Did you own a car [at some point in the past but no longer]? [past simple]

So here the 'do' does not mark emphasis, but a question structure. The overall effect of emphasis is achieved because the question is being asked rhetorically - no answer is expected. (See for instance the following posts about rhetorical questions:

  • How to identify a rhetorical question 1
  • What makes a question rhetorical 2

Solution 2:

This is an exclamation.

Closed interrogatives (yes or no questions) such as:

Isn't it cold!

Is it cold!

can be used as rhetorical questions indirectly conveying exclamatory statements: the implicit meaning is close to that of the positive exclamative:

How cold it is!

Grammatically, these are interrogatives - questions, but we understand them as exclamatives because of the context, or the way they are said by the speaker (CaGEL p922-933).