To do this, you'll have to land your plane. You will be informed through mission dialogue cues when it is appropriate to do this, but you won't be limited only to those occasions. You will be able to land whenever and however often you want to replenish your ammo. Sometimes you'll have to decide on your own if you want to risk running out of ammo or take the chance of leaving allied troops exposed while you make a quick dash to the airfield or the aircraft carrier.
In some missions, you'll be able to change the weapons you take in flight with you. Extended battles will have you fighting a lot of different enemies, so changing weapons accordingly will allow you to do more damage.
What kind of player are you? Do you usually conserve your ammo or are you constantly firing, requiring many refills? Let us know!