What do we mean when we say it today?
Nowadays, this phrase means the exact same thing as it did in Shakespeare's day. Let's say you don't really want to do something, but you're in a jam. You might make a good thing (virtue) out of something you have to do (necessity). It's one way of making the most of a not-so-good situation.
We do it all the time to brighten the day. Sooner or later, those tasks that you were forced to do become no biggie. That is, if you've got this 'tude goin' for ya.