The assumption is that all walls are sturdy enough to be able to hold a shelf, but the truth is that some of them are not, so you want to make sure that yours is. What you don’t want is for your shelf to sag and collapse, so you are either going to need blocking behind the drywall, or studs where you want to attach them.
You also want to make sure that you have enough space on your walls for the floating shelves. If you want longer shelves, you want to make sure that you have a big enough wall space to accommodate them. Making sure there is enough space will prevent a cramped look.