We are not explicitly told who was the first wife of Elkanah, so we cannot be certain. However, I note the following facts:
- polygamy in ancient Israel was relatively rare among the common folk, except for the very wealthy and the kings
- among the common folk, second marriages were usually made only out of some necessity rather than anything else
- Hannah is listed first, ie, before Peniniah
Based on all this, is quite probable (though we are not told!!) that Elkanah contracted a second marriage because his first wife was barren. However, this conclusion should be regarded as tentative in the absence of explicit data.
Gill appears to agree:
Very likely Hannah was his first wife, and having no children by her,
he took Peninnah, who proved to be a rough diamond:
Matthew Poole reaches a similar conclusion:
He had two wives; as divers other good men had in those ages. And it
is probable that he took a second wife, to wit, Peninnah, because
Hannah, who being first named seems to have been his first wife, was
barren.