The definition of a fishwife is tied to both of the definitions you listed. Wikipedia's article on the fishwife explains that:
A fishwife or fish fag is a woman who sells fish.... Fish women were notoriously loud and foul-mouthed as in the expression, To swear like a fishwife. One reason for their outspokenness is that their wares were highly perishable and so lost value if not sold quickly.
Unlike its common usage today, wife meant any woman, not just a married one. Some words still retain this meaning:
This usage stems from Old English wif (woman) and is akin to the German weib, also meaning "woman". This sense of the word is still used in Modern English in constructions such as midwife and old wives' tale.
So historically, a fishwife was just a woman who sold fish. Over time, since fishwives were often "loud and foul-mouthed," their job title became synonymous with your definition of "a bad-tempered woman with a loud voice."
Interestingly, fishwives have had different reputations in different areas. In Billingsgate, there were "the wives of Billingsgate" who:
dressed in strong 'stuff' gowns and quilted petticoats; their hair, caps and bonnets were flattened into one indistinguishable mass upon their heads. ... They smoked small pipes of tobacco, took snuff, drank gin and were known for their colourful language.
On the other hand, the fishwives of Newhaven, Scotland were:
noted for their beauty and industry, and celebrated by royalty.