Most are herbivores, but carnivorous birds and probably various closely related theropod dinosaurs also developed beaks. For the simple reason that the premaxilla is usually the animal's most anterior bone, it is frequently the part that gets into trouble first. Quite likely this provided a powerful selective force favoring the formation of a fairly small, thick bone in this position, separate from the main body of the maxilla. In this way, an unexpected blow from the front is less likely to destroy the entire upper jaw or the structure of the face. As noted above, the premaxilla may also become involved in the structure of facial ornament such as crests and the elaboration of the nasal passage in hadrosaurs.
Every elongate organism has to have a front end.
So, in a sense, analogs of the premaxilla go as far back as chordates with bone. However, the premaxilla, even considered as a functional unit of the skull and without regard for phylogeny, is a much more complicated object. As fully developed in advanced tetrapods, it has a three-fold structure. Internally, it is involved with respiration and chemosensation. In a very broad sense, the premaxilla seems to have acquired these functions in the order listed.