An onsen is a Japanese bath house. It is, sort of, the Japanese word for bath house, but honestly, a trip to a real onsen will convince you that a bath house is just a bath house, but an onsen is something else unto itself, and not just because many of them are built around a natural hot spring.
As I am myself a gaikokujin, I won't claim to be any sort of authority on onsen, but I can offer up a few points of advice that will help you get through your onsen experience without seriously embarrassing yourself.
Before you go
In Japan, tattooes are still not accepted by polite society, and are (wrongly) thought to only be worn by yakuza and punks. If you have a tattoo (especially if you are male) the onsen attendants may not want to let you in. Try going with friends and you shouldn't have a problem.
If you are at an onsen hotel or resort, you may be expected to go to the onsen wearing a yukata, which is a short, thin summer kimono. It will be provided for you in your room. Close the yukata left-over-right (from the wearer's point of view*), as right-over-left is only worn by dead bodies at funerals).
In the locker room
Onsen are usually gender-segregated, but you are supposed to be naked. There is usually a bin of little towels that you can use to preserve your modesty, mop your sweaty brow, or wring water on your steaming noggin. Grab one and keep it with you until you leave, when you drop it in the wet towel hamper.
Dump your clothes or yukata in a locker. If you have glasses, you can take them with you, but they'll steam up quickly, so you may want to just go blind.
In the bath
You're supposed to clean yourself before you actually enter the baths. Sit down on one of the little stools in front of the showerheads. Wash, with soap, and wash your hair too. You signal that you are done by filling up the bucket with water and pouring it over your head and down your back. You'll have to do this all again before you go back into the locker room.
Don't get offended if many of the old Japanese people soaking in the baths decide to leave after you show up. Sadly, some Japanese people, especially older ones, feel uncomfortable around foreigners. There's not much you can do about this.
Now relax, and let the onsen goodness just wash over you.