Libraries in computer science refer to precompiled collections of code modules or functions that developers can use when building software applications. They provide ready-to-use solutions for commonly encountered programming tasks, saving developers time and effort.