What happens if your research doesn't get published?
In academia it's true that by "publication" people often mean "peer-reviewed publication", that is a publication which has been checked and validated by other researchers and consequently accepted in a more or less reputable journal or conference (see below for the "more or less"). Peer-reviewed publications are the only ones which matter in terms of academic career and in any kind of academic evaluation.

However there are plenty of other options to publish: pre-prints, technical reports, books or even simply putting a document on a webpage, all of these are valid publications which can be cited, even if they are not peer-reviewed. Of course they wouldn't be considered as valuable publications in the academic world (unless they get cited a lot, but that's not common), and for good reasons: non-peer reviewed publications can be full of mistakes or claim that the Earth is flat, since by definition they haven't been evaluated by the expert community. Anyway, this implies that it's virtually impossible to be unable to publish a research work because it gets rejected.

Even if we assume that the author wants to publish only in peer-reviewed journals/conferences, they would still have a lot of options to choose from and it's unlikely that they can't get accepted anywhere: in every field there are venues which are known to be very reputable and consequently very selective, but there is also a spectrum of journals/conferences which range from "very competitive" to "desperate to receive submissions". Of course publishing in a bottom tier venue is not going to boost an author's track record, but at least it's reasonably easy.

Finally, even in decently reputable journals/conferences, any serious research work can always be accepted... eventually. It might take a very long time, but if the methodology is correct, the state of art is properly covered, the motivation for the work is demonstrated, etc., in short if there is a real scientific contribution then it's very unlikely that the work would be rejected everywhere. Even in the case of negative results, e.g. the author attempted a new method and it failed, there is a legitimate contribution: provided it wasn't already done and the method makes sense (that's part of the scientific ground work), it's useful for the community to know that this method doesn't work. Additionally every rejection comes with reviews which explain why the paper is rejected, and normally addressing the shortcomings identified by the reviewers makes the paper more likely to be accepted next time.


  "Is publication the only way researchers can validate their work?"


Not necessarily but the other ways I can think of are more specific to the field. For instance in computer science developing a software system which turns out to be successful in the scientific community or even beyond would actually prove the value of the work and certainly contribute to the author's reputation.