You can just use one 12 inch board. As long as the timber is seasoned properly, and at a suitable moisture level when you use it, it'll likely be fine.
That said, there are some benefits to using multiple pieces:
- If your moisture levels are wrong or the timber has not been seasoned properly it may warp, twist, bow, etc. - using multiple pieces glued up protects against this somewhat. It is less likely that two (or more) different pieces of timber will want to twist, warp, etc. in exactly the same way, so if one does want to move then the second (and third, and fourth...) piece(s) will resist that movement.
- Cost - it can be cheaper to get two (or more) smaller piece(s) than to get one large one. Sometimes this is because of things like finding defect-free timber - for example, it's easier to find a 6-inch wide piece with no defects (knots, etc.) than to find a single 12-inch piece. Taken to its extreme you will see (particularly on cheaper furniture) finger-jointed timber, where the wood is joined up not just in the width/depth but also in length, every few inches or so. This allows the very efficient use of timber since there is barely any waste - even the smallest pieces can be used.
- Strength - kind of tied into the points above about movement of timber and also defects, for more structural uses (timber laminated structural beams), this means that you can have enormous pieces of timber, glued up from smaller pieces, with no defects whatsoever. Laminated timber isn't necessarily stronger than a non-laminated timber piece of the same size, but on average it will be because again you average out any tendency to warp, twist, crack, etc. This one doesn't really apply to your typical bookshelf but I've included it for completeness.
- Shaping - again doesn't really apply here but gluing up multiple smaller pieces of timber (or thin boards to form a thicker one) allows you to create shaped timbers more easily. You can glue up several thin pieces, bending each one and inserting into a form of some kind, or e.g. clamping to a bench depending on scale, to end up with an arched or curved piece larger than what you'd be able to bend without steaming.
- Handling - maybe you can't run a 12-inch board through your planer/thicknesser, but you can do two six-inch boards and then glue them together.
As mentioned, not all of these are going to apply in every case, but it's worth considering depending on your application.