Metal detection is completely legal, but you must meet some requirements. In Flanders, licence must be requested from the immovable heritage department. This is free and no exam is required. In addition, there is a reporting obligation. All historical finds must be reported via the portal of the immovable heritage service. In addition to the recognition obligation, you also need permission from the land owner or manager to be allowed to search. For beaches, this is the municipality to which the beach belongs. For agricultural land, ask the landowner or tenant for permission. It is of course prohibited to search in nature reserves or archaeological sites.
In Wallonia there is a similar system as in Flanders, where you must apply for license from the AWAP.