The answer is "It Depends" ...
You generally need to prime if you're painting dissimilar paints, or if you're not sure what the previous paint was, or if you have sanded to bare wood or bare drywall, if you have patched with anything that does not specifically say it's paintable, or if you want to ensure a uniform finish.
For instance, if you were to paint oil paint over bare wood, you would get bad results. Same as if you tried to paint latex over oil since oil paint is hydrophobic. Oil primer is typically formulated to allow application of latex over it, but not always. Shellac-based primer is the best choice if you want to paint over ANYTHING and know that your primer and finish coats will stick.
If you're applying latex paint to a clean latex surface, go ahead, paint away. If there's dirt, grime, grease, or topping out my list of "unusual reasons the finish coat didn't stick", hair spray, you probably want to prime first.