It's difficult to determine the exact number of libraries that exist in the world. There are also different types of libraries (e.g. public libraries, academic libraries, special libraries, government libraries, school libraries, etc), so the total number of libraries that exist depends on if one is referring to only one type of library or to all types of libraries.
One estimate from the OCLC gives a number of approximately 1 million libraries worldwide.