/script ClearCursor() PickupInventoryItem(16) PickupInventoryItem(17) ClearCursor()
This takes whatever's in your main hand and places it in your offhand slot, which should swap them automatically. The ClearCursor is there in case you accidentally pick up something that can't be swapped.
I think those are the proper commands, but I can verify it at home. Argh... now I can't remember which slot #s are MH and OH. Someone could look it up on wowwiki or just test it and see.
It should only cause one GCD if you're in combat.