Why do some researchers publish preprints? I am not a scientist but asked this on a medicine professor. He said that it would be bad for a scientist's career if he or she publishes a preprint and someone takes the results and publishes the article before he or she gets the publication to a journal. Are there some benefits of preprints?
Answer to this are going to vary depending on whether you ask a medic, a biolgist, a chemist or a physicist.
In physics pre-prints are just "the done thing". In biology they are becoming more common. In medicine they are still rare.
The easy answer to the question what happens if someone "publishes a preprint and someone takes the results and publishes the article before he or she gets the publication to a journal"? Then the answer is that this is precisely one of the things that a preprint is supposed to protect against - if you have a preprint out, you have evidence that you had the idea before the other person published. Many (although not all) biology journals these days will recognise the priority claim of a preprint. Thus, once you have preprinted, you are unscoopable.
As has been mentioned by @CJR in comments - it is also proof that you have done the work when you apply for a job. Papers in biology often take the full length of a PhD or a postdoc to complete. Thus you are unlikely to have the peer reviewed article out when you apply for a job. A preprint allows to you say "look - i really did the work and the paper really is written, even if its not out yet".