Dates back to 1850, but the exact origin is unknown. One theory is that it comes from the theater world, where musicians were in a pit in front of the stage, so "to face the music" was to turn towards the audience. Another theory says it comes from a Civil War military ceremony where an officer that is about to be cashiered is literally drummed out.
Come out and face the music. I know what you've been doing to my socks.