its no different than walking in the woods and finding general lees pistol...it's yours.
Bit of a nuance needed.
When a ship sinks there are several stages it goes through before becoming a derelict.
The ship has an owner and usually an insurance company
The cargo has an owner and usually an insurance company
All these parties have to figure out if something can and will be salvaged. Until that's all done then a sunken ship is like a car that broke down on the side of the road. you can't just haul it back to your house and call it yours.
If the owner of the ship/cargo and any stakeholders in salvaging have decided to declare it lost then the responsibility defaults within territorial waters to the country it's sunk in. Then the government decides what can be done. It might be opened for diving or protected for historical/archaeological reasons etc. The point here being that someone decided how that wreck will be used by divers and you have to know what they decided to avoid trouble. That's what happened here. The divers didn't follow the government's rules and were arrested for that.
In addition, some countries, like the UK declare all of its war wrecks monuments/graves and enforce UK law for monuments/graves regardless of where the wreck is. There are rules for these wrecks. You can usually dive on them but you can't move or salvage anything or photograph/film human remains. Other countries, like Canada have a "don't touch" policy for all wrecks under their jurisdiction, regardless of how silly it is.
Some ships, however, have been declared lost by all the stakeholders, they don't have any interest for a government and they're in international waters. These wrecks are really the derelicts and THAT is when it's like finding an old piece of junk in the forest. Salvage away.
So yeah. It's not all as simple as finding something in the forest and saying "finders keepers".
R..