Yes, this is a real thing that happens, and there are a number of reasons for this. Some of these reasons are good and some are pure tomfoolery. For example, funding bodies, scientists, general public and the politicians would be greatly appreciative of harassment of a scientist that was involved in dubious or unethical science. This harassment in fact would not qualify as harassment by strict definition of the word, yet I am sure the person on its receiving end would perceive it in this way.
However, this is not a post about justified reasons to criticize science. After all the scientific method exists, in a manner of speaking, for the purpose of criticizing bad science and exposing flaws in accepted science. So, what methods exist that can truly be considered harassment of scientists.
Probably the easiest go-to in this argument is animal rights activists, as they truly do not understand (in my opinion) what scientists are trying to do when they have to do animal studies. Many of these activists believe that scientists are actually trying to hurt the animals when this is very far from the truth. For many scientists, it is rather a stark reality that has to be dealt with when progress is desired. However, when you have a bunch of fundamentalist animal rights activists waving the flag of abusive scientists then public perceptions can be swayed, and this could rightly be considered harassment. This is neglecting the obvious harassment by animal rights activists such as property destruction. On a side note, why do animal activists worry so much about other animals yet are content to allow humans to get rushed about in commuter trains that are way worse conditions than many animals get transported in.
Another example of extreme harassment is anti GMO-proponents, who do not understand that consuming GMO crops does not translate into people growing wings or gills overnight. At the same time, these activists use discredited science to promote an agenda which is unscientific and highly dubious. In fact the anti-GMO proponents in many ways are the "scientist" that should be getting harassed as they are the ones promoting junk science. Interestingly, the harassment of scientists by these GMO pseudo-scientists can cost the tax payer more than it would normally cost to run safe and effective trials. In effect they are promoting funding towards GMO tests, irony anyone?
What these GMO and animal testing scientists (as well as other fields) go through on a daily basis truly classifies as harassment. However, many people think it is acceptable as it falls under the scientific method of critique. This would be true if it was only critique and not personal harm, but even then these critiques have been dismissed multiple times already and as such they would classify as harassment.
So what can be done? Sometimes, I really think that a way to get around these types of harassment would be for scientists to let people suffer. That is, just step away from the massive problem solving they are involved in and say deal with it yourself. But........... that would not be ethical.