Suppose some author provides his original research article to a journal for publication. In this way, he is disclosing or revealing his confidential research work to that journal. Now, consider the case that his article gets rejected. So, is it not possible that whoever reviews that article can publish that kind of work and say that it's theirs? Since the original author's work has not been published and he is disclosing his confidential work to somebody, how could the author get assurance that if his article is rejected, his work will not be leaked by the journal staff in any form? What happens if this kind of thing happens?
It is unlikely that a reviewer or other participant in the peer review process will outright steal the work he/she is reviewing and publish it as original work, because it is easy to get caught.
If the "real" author of the work accuses the thief of plagiarism, the editor of the journal can verify that the work was originally submitted by the "real" author before it was published by the rogue reviewer. (Also see: What to do if a referee plagiarises the result after rejecting a paper?)
If the rogue reviewer is caught, the paper will be retracted (which is damaging to his professional reputation) and there may also be other consequences for the reviewer. See e.g. this recent example.
Let me add to @ff524's excellent answer. If you are paranoid, one way to add an additional safeguard would be to post a preprint on arxiv.org or a similar site. Then you have a public version with a verifiable timestamp, so even if all the journal's staff colluded to steal your idea, you could prove to the community that it was originally yours.
Here is the advise I got in a creative writing course a while ago:
Print out your article, book draft or whatever. Put it in an envelope and send it to yourself by registered mail (yes good old paper mail). Of course you keep all receipts and administrative documents you get at the post office. Don't open the letter when you receive it.
That gives you a formal and legally binding proof that your text existed at the time you posted it. In case of a formal dispute you have it opened in the presence of notary or whatever legal person can formally confirm the content of the document and the date.
If you will submit to good leading journals of the field, you shouldn't be bothered by this question. If someone is good enough to be a reviewer, she/he has has the ability to produce respectfully publishable papers, and is likely to be a honest person. Only enclosed minds would do such a thing, anyway. Moreover,the journals keep their correspondence up to 5 years, so a legal process could in principle be done if would be the case.