The legality of metal detecting depends almost entirely on who manages the land you're standing on. There's no single national rule — what's allowed on a county beach in Florida has nothing to do with what's allowed in a state park three miles away, which has nothing to do with the national seashore next door. Getting this wrong is the most common mistake, and it's the one that gets detectorists cited or banned from sites.
The clearest line in US metal detecting law: National Park Service land is off-limits. All of it, everywhere, under 36 CFR § 2.1(a)(7). No exceptions for beaches inside national parks, no exceptions for "just looking." The penalty is a federal citation and potential equipment confiscation. Most other land types — public beaches, BLM land, county parks, national forests — follow their own rules, which vary considerably.