There are two major differences between writing for publication and writing for a class: audience and purpose.
Your audience (or readers) when you write for publication is much larger. Anyone who reads the publication is in your audience, so you will want to think about:
Depending on where you publish, your audience could be very big (e.g., if you publish in a major newspaper or magazine) and / or have varying degrees of previous knowledge about the topic.
The audience for a scholarly publication will likely already know a good deal about your topic, whereas the audience in a popular / news publication may or may not already know a lot about it.
You will want to carefully consider your piece's audience as you write it. This will influence your tone, your vocabulary, length of your piece, level of depth, etc, so it is critically important.
Purpose and Audience are related -- who you are writing for will influence what you want the audience to do / think / feel after reading.
Think carefully about why you are writing. Some questions to ask:
Writing a journal article is complicated and involves awareness of standards in your field in addition to general best practices. The resources here are general, and can give you a sense of the big picture of writing for publication -- that said, you will want to consult materials related to your area of study as well.