The first flash is the pre-flash for the foreground object, metering for flash exposure. Usually most people won't see it because under normal conditions (e.g. fill flash / first curtain sync, shutter around 1/120s) the pre-flash and real flash are fired very close together. It becomes more visible with 2nd curtain sync and shutter of 1/30s or slower.
I agree with Octarine. It sounds like they were using ttl flash metering and rear curtain sync.
The length of the exposure is purely for the background ambient light.
The first flash is the pre-flash for determining the flash exposure of the foreground subject and does not contribute to any part of the exposure.
The second flash is the one that actually lights the foreground subject only.
If you want to try this technique, you need to remember a few things.
- Tell your subject not to move until after the second flash goes off. Its quite funny how many shots I have of ppl walking away from their pose even after telling them to wait for the second flash.
- Measure the ambient light and set the exposure manually independent of your foreground subject. Eg. if you want city lights in the background perfectly exposed, then set your exposure for that first without worrying about the foreground.
- Set your foreground flash exposure independently. I find its easier to use manual flash mode for this but if you do, you'll need to tell your subjects when you're starting the exposure cos they won't know. If you use ttl, then the first pre-flash will tell your subjects that you're starting your shot.
- pose your foreground subject such that it receives little to no ambient light. You want to light your foreground with the flash only if possible to avoid a faint blur of motion. This will depend on how long your ambient exposure is. The longer it is, the harder it is for the subject to stay very still for the entire time.
- This technique doesn't work if there's a strong light source lighting your foreground already.
- the flash won't contribute to the exposure of things far away so don't worry, your flash won't mess up your ambient light exposure that you carefully metered for at the beginning.
- use a tripod if your ambient light exposure is long. Ie. less than hand-holdable shutter speeds.