The other answers/comments provide accurate information from the perspective of academia, where authorship (including co-authorship) is an important metric for achievement and prestige, and where a lot of attention is therefore given to its fair allocation.
I'll add a perspective from someone who has jumped around between academia, industry, and the grey area in between. In many instances in industry and general-public-focused publications in particular, it is only the prestigious seniors who get "credit in the byline". Or sometimes the publication channel limits the number of authors that can be listed and the contributors are expected to sort it out. When I was starting in my field, I was multiple times the grunt who did a lot of the work for such papers but wasn't listed as author, and in recent years have sometimes become the prestigious senior.
It is good form*, where someone has done a significant part of the work but isn't listed as official co-author, for them to be credited in the text or at least a footnote, e.g. "the author acknowledges the significant contributions of John Q. Hardworker, Jr. to this paper". But whether this happens depends largely on how much priority the prestigious senior puts on it, and often editors will resist. In particular, if the editors feel they have scored a coup by getting Amy Y. Famous to write a paper on "Future trends in intradisciplinary factology", they may not want to dilute the prestige by an overly fulsome acknowledgement that implies it was effectively ghostwritten.
As others have said, you can't claim authorship for a paper where you are not a listed author in the "Publications" section of an academic CV. But you can -- and should -- mention it under "Additional research experience" or somesuch. For the purposes of job hunting -- when you are still fairly junior -- or grad school applications, it should be still be treated as very positive evidence of your ability to do and write about research. As you become more senior, for a while it will hang around your CV as a shoe-horned unloved stepchild as you build up more conventional publications. (Many of us have them, the "it-felt-like-a-great-accomplishment-at-the-time-but-I-didn't-quite-realize-it's-not-peer-reviewed" type of publication) You will eventually axe it from your CV once it's long enough for it not to matter.
I'd like to hope the "prestigious journal" in question isn't an academic journal, since if they are, they really ought to know better. So probably even you had been listed, it wouldn't have counted as peer-reviewed.
*I recognize from the perspective of academia, it is much more than "good form", it is an obligation. I'm deliberately using this weaker statement here to emphasize that the culture outside or on the boundaries of academia can be different.