According to Abarbanel, at that time and in that area, it must have been customary for the father to give the name to the first child and then alternate with the mother for future children. Here then, Yehuda names Er, his wife, the daughter of Shua, names Onan, then Yehuda should have named the third child, except that he was absent during the birth ("וְהָיָה בִכְזִיב בְּלִדְתָּהּ אֹתוֹ"), so the mother named him instead.
In modern Biblical scholarship, the fact that sometimes the father names a child and sometimes the mother does is seen as strong evidence for the Documentary Hypothesis. One source must have originated in a culture in which the father customarily named the child while another was written in a culture where that custom belonged to the mother.
Professor Umberto Cassuto, in his book (actually a transcribed and translated series of lectures) "The Documentary Hypothesis and the Composition of the Pentateuch" to combat this evidence, writes as follows:
When the Torah informs us of the name given to any child at birth, mostly it advances, as we know, an etymological explanation alluding to some circumstance that preceded or accompanied the birth. Now whenever this factor, to which the name owes its origin, is connected with the father, then the naming of the child is ascribed to the father, and when it is related to the mother, then she is said to name the child. This rule is simple and logical, and is valid in every case, without exception. When the circumstance appertains to the son himself or no etymological explanation is offered (which rarely obtains), then the rule does not, of course, apply; in one of these instances the naming is ascribed to the father, in another to the mother, and in the rest it is stated indefinitely, "one named" or "they named".
This case seems to be the exception to the rule mentioned by Cassuto. No explanation is offered for the naming of Er nor of Onan. (One can consider "וְהָיָה בִכְזִיב בְּלִדְתָּהּ אֹתוֹ" to be the explanation for Shelah's name.) Why, then, does the Torah specify who named the child? We can revert back to Abarbanel's explanation that this was merely the custom at the time. Or, more likely, the names were inspired by circumstances that preceded or accompanied the birth just like the other namings in Bereshis, except that for some reason the circumstance is not specified in the text. I wouldn't be surprised if there was a midrash somewhere that fills it in, but I know of none.