This happened to me second time that my article got rejection after several months of review when article was not under actual review. Ten months ago I had submitted my work to mathematics journal of Elsevier, one month after submission my article status changed to under review, and I started waiting for review outcomes, but after ten months of review, editor responded: "I have checked your manuscript with care and I come to conclusion that your work is not suitable for publication in our journal". How could they take 10 months to decide the eligibility for aim and scope, why they put "under review" label for article when actually it is not under review?
"Under review" may include the review of the editor or editors, so in this case it may be under review. It also may be (as Maarten commented) that the paper was sent out and the reviewers indicated that the paper was not suitable for that journal without comments.
A few years ago I had a terrible experience where a journal had a change in editors and management and they lost my paper. I had no idea and they would answer my emails about the paper, but never get back to me about why I couldn't get any information about my paper. This went on for about a year. Ultimately, it worked out, but remember that editors and reviewers are often volunteers, so some may not put their reviews as a priority in their schedule. This isn't fair to the authors, but it is the truth. I'm sorry you dealt with this frustrating situation, but I find that these things are a lesson learned and if anyone asks you about your thoughts on submitting to that exact journal, you know what to tell them.
"Injustice" is a fairly strong way to phrase this.
Is it annoying? Yes. Is it possibly reason to reconsider submitting things to this journal in the future (assuming 10 months is unusual for your field)? Also yes.
As for how this is possible, there are a few major mechanisms:
- "Under Review" may include Under Review by the Editors. That process may simply take a long time (editors are busy people), or have required a great deal of time in finding an editor who could do the initial evaluation, take the time to look it over, etc.
- "Under Review" may also include the process of looking for reviewers, and this proved particularly difficult and/or time consuming to find. So, after failing to find some, the editor may have sat down to make the calculus of whether or not to continue pursuing reviewers and decided that your paper wasn't compelling enough to chase after it.
Regardless, you can't actual know that it wasn't under something that the journal considers review.
Depending on the scope of submitted paper, editors sometimes have hard time to find a suitable reviewer. During the process, a considerable amount of time might be needed.
The reviewing process starts when editors send the paper to the first suitable reviewer, and ends when final review is complete. Usually, it is not a single reviewer, but several reviewers.
Unfortunately, some reviewers might reject to review the paper for various reasons. If the general response is "I cannot review because the topic is out of scope," then the editor might decide it is not suitable for the journal as well.