Publication can be any of those.
Length of time to publish?
Depends on your:
PI
Lab mates
Project (complexity, how far along it is when you join, number of people working, etc.)
Time commitment & level of involvement
Resources and funding available
Personal/technical skills
Team skills, if applicable
Team chemistry, if applicable (yes, this does matter; I've seen acts of sabotage, and I've also seen data theft. These certainly have an impact, regardless of how common/uncommon)
Phase of the moon
Luck
Error (could somewhat relate to luck, sure)
Publications are great. But you can also do poster presentations, submit abstracts, attend national conventions, and do outstanding research, all without publishing (as an undergrad, of course. As a PI or grad student, it's kind of in the job description).