Tasker will do this. Locale (and probably others) should be able to do this as well (locale may or may not need a plug-in; I don't know, as I don't have that app).
To turn it back on when you're home, you would need another way of checking location. In my case, I have tasker set up to check what cell tower it is connected to. If it is on one my "home" towers, it will change settings for home use (in my particular case, it deactivates the pattern lock), and when it is on any other tower, it changes settings for "away" use (it reactivates the lock pattern; you could easily change this to toggling wifi, though).
A couple of things to note: With this method, there can be a wide range of what constitutes my "home area", as each cell tower has about a 2km connection radius. However, this is also the most battery efficient method. As you want to toggle wifi (the second most efficient, and more accurate method), obviously you can't use wifi to determine location (unless you want it to automatically toggle after a set period of time to check for a known network).
There are some settings that tasker (and presumably other automation apps) cannot toggle in Gingerbread, however the Secure Settings app will allow this. Some settings can only be toggled if you have root.