To catch a Magnemite in the Generation III games (Ruby, Sapphire, and Emerald), head to a place called New Mauville. It is a cave located in the middle of the lake on Route 110.
There is a catch, though: you can only enter New Mauville after you defeat Gym Leader Norman in Petalburg City. Once that is done, the cave is open, and Magnemite awaits inside.