Mark Thoma has a rather interesting idea:
Producers may shift production closer to the markets where the goods are sold as transportation costs increase with energy prices. If so, it’s possible that higher energy costs could cause producers to shift production to Mexico, and this in turn could reduce the flow of illegal immigrants into the U.S.
It’s probably true that the average Mexican worker would much rather have a steady legal job in Mexico than an unreliable and illegal job in the US. But I think that transportation costs are going to have to stay very high for quite a long time before manufacturers start relocating their factories to Mexico just to save on shipping.