That’s what the Pinafore was; “pinned afore,” pinned at the front (of a dress).
The item pinned was some sort of wash material which served as an apron or bib to protect the front of a child’s dress, a dress then worn by either girl or boy child.
That was back in the latter part of the eighteenth century.
Many years ago, however, though the name was retained, the garment underwent a face-lifting.
As now worn, by women or girls, it requires no pins and covers most of the dress.