You seem to be genuinely curious, which is commendable.
>Will that apply to every law in society or just to H1B laws?
The H1B laws are harder to enforce than most laws -- or so it would seem to me -- because the question of whether there are Americans that are able to do a particular job at a particular workplace depends on many fiddly details that only the managers of the particular workplace (the prospective defendant in any enforcement action) would know.
When lawyers working on Capitol Hill are serious about stamping out a behavior, they write laws that are easy to enforce (unambiguous, not relying much on human judgment). Something as vague as, "as long as there are no Americans qualified to do the job," suggests that whoever wrote that just wants to reassure critics of the H1B program without caring much whether H1B workers actually displace American workers.