While I think employers should not ask for these passwords, and don't have a "right" to, I also have the right-- freedom of association-- to not give them the password, and not work for companies that would even ask.
Maryland is interfering with these rights. Maryland is violating freedom of association by dictating what terms people might choose to associate under. I doubt the Maryland constitution gives them the power to do that, and certainly many interpretations of the Bill of Rights have claimed that they restrict state's lawmaking ability.
I don't know what employers might reasonably want this information. Possibly an employer might wish to conduct a background check for a highly security intensive position, and this check might involve access to some website (lets assume it is not Facebook) that the applicant feels perfectly comfortable with them seeing. Further, this access could be conducted with the employee present, with the employee changing the password immediately before giving the access and then changing it again immediately after, resulting in no ongoing access. I don't know what situation someone might find it reasonable to do this-- I can't know.
But neither can the government of Maryland. The problem with these kinds of laws is that they always have unintended consequences, and at the end of the day, any violation of peoples rights-- even with "good intentions" (though I bet this law exempts the state of Maryland itself) -- will result in less optimal outcomes.
For instance, consider the situation where this law is challenged and then upheld. That would establish a precedent that says the state can interfere with freedom of association, and such precedent might be used to undermine freedom of association in areas where we do care about preserving it. This has happened many times in the past-- for instance the "interstate commerce clause", which doesn't actually grant broad powers, but very narrow ones, has been rewritten via precedent to give the federal government essentially unlimited power, even where no commerce between states occurs.
I expect to be down voted for expressing this unpopular opinion. But hopefully Hacker News is the kind of place where making an argument -- even if most people disagree with it-- is respected. (and I'm curious to find out, having recently seen instances of it going both ways.)