Licences do not inhere in software, they attach to software (or, to be more precise, to the recipients of software) through the act of conveyance.
Which is a complex way of saying that what other licence some other person gets software under has no effect on you and the licence under which you get it. If you get
libfoo under a free licence, let's say the GPL, then you have the freedom to use it for any purpose (as well as the other freedoms that free software comes with, and the conditions that the GPL applies to them). Just because somebody else gets
libfoo under a proprietary licence (say, one that lets them build it into a software product without honouring copyleft, but only up to ten thousand copies) that doesn't mean that your freedoms go away. Similarly, your freedoms don't automatically transfer to them.
The title question can't be answered, because it assumes that software just sits there, with rights associated with it, which it doesn't. Instead, the rights you have with respect to a piece of software will depend on the licence terms presented to you when you got your copy of the software, and they won't depend on any licence terms presented to anybody else when they got their copy.