You get it from the gym leader.
After you beat Norman(Petalburg Gym leader) and get surf, go to Mauville and the gym leader will be standing in the middle. He will give you the key. Then go down near the cycling road and surf. Then go right and you will see a cave.
Watson gives it to you
To get to new mauville
First beat the Mauville Gym leader, Wattson.
It’s in New Mauville, which is a cave on a tiny island southeast of Mauville City. You’ll need HM Surf to get there.
You can find the thunder stone in New Mauville
new mauville after you get a key from Wallace
In Pokemon Emerald, New Mauville is south of Mauville City. Go to the first Fisherman you see when heading south from Mauville City. Surf on the body of water that he is facing, then turn left. As you keep Surfing east, you will find a cave. If you have a Key from the Gym Leader, Wattson, enter the cave, open the lock, and do your mission for a reward from the Gym Leader!
if you are looking for the new mauville basement then you have to go south of new mauville and find a place to surf in the route between mauville and slateport and you will find it on the right side of the screen
New Mauville MissionMr. Wattson wants you to turn off the big machine at the end of New Mauville by pressing a red button. The cave's full of Electric-type Pokemon and no Trainers.
You can get a magnemite in New Mauville.
Go south until you are below and out of Mauville City, and Surf in the water until you find a cave: That;s New Mauville.
After a certain point in the game, you will see Watson standing in the middle of Mauville outside of his gym. If you talk to him and agree to help him with his problem, he will give you the key to New Mauville.