Charging a circuit to around 10kV from 3V (two AA batteries) for discharge over 20msec
How can I design a circuit that can be charged to around 10kV (somewhere between 5 and 20kV is fine) from two AA batteries (~3V)?

The difficulty in this question is understanding some of the requirements so I'll address this first because without answers it's debatable that this can be answered properly. 

Firstly, is the load going to be applied once the output cap is charged to the required voltage? If the load is present all the time during the "charging process" then the power required is very much more than some of the answers and comments anticipate. I don't think a solution is achievable if load is always connected so I'm assuming it isn't.

The OP also says "the output current will be current limited to a maximum of 20mA". Is this a requirement of the solution or something that is external to this question? This needs an answer but for now I'm assuming it isn't required in the solution.

Proposal - A transformer is going to be needed that steps up the 3V (nominal) supply to probably about 800Vp-p. With a split primary and two N channel MOSFETs, an effective primary p-p voltage of about 12V(minus a bit of loss) should be attainable. The secondary will therefore have between 70 and 80 times the turns of the primary: -



I think this is reasonable do-able and at a decent switching frequency of up to 1MHz. From experience i don't believe a transformer with more than about 100:1 stepup is practical - just too lossy. 

The MOSFETs are not going to be common-place items. I think they'll need to be something like 60V rated and have an on-resistance down close to the 10 milli-ohm area. Low drain capacitance is also a requirement. More detail later as I think about it and simulate it.

Driving the MOSFETs is also tricky. It's likely that they'll need to be driven with 10 or 12V gate voltages and this means that a small boost convertor will be needed to power the switch control circuit from the 3V. This isn't a big issue. I did consider having the booster provide the power to the transformer primary but this is a significant source of inefficiency and I believe a higher turns ratio on the transformer is the best idea.

There is detail in the switch controller that needs to be ironed out like having it perform a gradual soft start to build up the o/p voltage preventing the batteries from "collapsing" under the "pressure".

The final stages would be several ( less than 10) cockcroft walton multipliers and I think the diodes used will need careful selection. More detail later - I have one in mind but I left my notes at work and my memory is letting me down!

Sorry I haven't got the full details yet but of course the question is "how can I design a circuit" meaning how can the OP design the circuit.

Mondays additions
Here is the basic circuit I came up with - it generates a bit over 6kV and I decided to go for 40V rated FETs in the end because I limited the back emf with 18V zeners: -


Here is the output after applying the battery. Lower display is the FET drain voltage and current taken from the battery thru 0.1ohms in series:-



To overcome the battery's inherent resistance I used a 1mH inductor and 5uF capacitor to act as a voltage booster during power up. The best way of doing this would probably be to charge a decent sized capacitor (1000uF) up to 5V over an allowable time period and let it act as the boost to achieve +6kV output, then return to the 3V battery for trickling energy into it to keep the output at 6kV. Alternatively, as the OP wants only a 20ms period of high voltage at the output, the 1000uF may suffice to keep things reasonably steady for that period and if not increase to 10,000uF.

Not shown is the boost convertor that powers the 1MHz oscillator. There are several devices from Linear technology that would perform this function. 12V is needed for driving the gates.

Small Print
The secondary of the transformer needs care in winding to keep capacitance below about 10pF. I'm not going to go into this but suffice to say, the output circuit relies on secondary resonance and so a trimmer cap of 20pF should be used to optimize output voltage without over-resonating it and causing large inefficiencies in power transfer.

Bear in mind that this could easily kill you if you do not take care. Be warned.