The physical card is less important than a reliable way of linking you to your account. For example:
I work in a public library. The circulations staff can manually check out materials if you provide an ID that they can use to look up your account by name and address. (Address is important; even in a small suburb, there will be some overlap between names!) If someone has moved, they presumably know their former address and we can go through the process of updating that information as well. Most people don't want to go through this process, though; it's much, much quicker to use a self-checkout machine! The thing is, the machine can't read and interpret every ID in the world. Instead, a physical card with a barcode on it suffices to identify you to the machine. In theory, some of the machines could even read a photo of the barcode on your smartphone, but the library would still need to issue you that original exemplar.
A large national library is going to have lots of readers from all over. Many will have similar names, may move between visits, may be from countries with unfamiliar IDs, &c. &c. &c. It's much easier (and more secure) to have a uniform photo ID that all the employees understand to represent you and your specific privileges at that library. Also, if you've moved or otherwise need to update your information, it's much easier to prove that you're the Mr. So-and-So who used to live at 123 Cherry Lane if you have a card proving that you are the holder of the account with the out-of-date information in it.
Other institutions that have libraries (e.g., academic libraries, corporate libraries) don't usually issue separate library cards because they will already have some form of universal ID (e.g., a university ID or corporate ID) that it designed so that it can be used for that purpose as well or another method of identifying people with access (e.g., a signed letter from your supervisor, a librarian who knows everyone in the building).