Shimming loose AA batteries with aluminum foil... Will this cause corrosion?
The battery will be fine.


  Would galvanic corrosion cause either the battery or contact materials
  to become damaged?


While galvanic corrosion is possible between aluminum and nickel (or nickel and any other metal), in most environments, it is not a problem.

Yes, it is possible, but it would depend on the life of the battery (e.g. replaced monthly, yearly, or decennially), the environmental moisture content (e.g. air humidity) and the galvanic component potential. 

Humid air is the most likely electrolyte. 

If the humidity were 100% then the following may apply (submersed in tap water).

Aluminum has a galvanic component potential of about -375
Nickel has a galvanic component potential of about -125
The difference between the two is only 250.
The difference between the two in sea water is about 450.    

So it depends upon the environment.  For example if it were used at the beach (with high salt and humidity) would be slightly (insignificant) worse than in an air conditioned office.

 

Source: THE EFFECT OF ELECTROLESS NICKEL COATINGS 


  Does it matter whether you put the aluminum foil on the positive or
  negative end of the battery?


Good question.  I do not believe that current flow has any effect on galvanic corrosion.  I have never see this said in any papers I have read on this topic.  Intuitively it would sound reasonable the current would exacerbate the corrosion.  But I have not seen any papers written proving this to be true.  I first learned about galvanic corrosion back in 1972 about joining copper and iron water pipe when I was doing plumbing. Joining copper an iron requires a fitting called a dielectric union.    

There are three things necessary for galvanic corrosion. Current flow is not one of them.    


Electrochemically dissimilar metals must be present e.g. iron and copper
These metals must be in electrical contact, like pipes screwed together
The metals must be exposed to an electrolyte, like water in the pipe.