The common answer for this is that it is a joke. He was singing that because he was singing a few bars. This is a wordplay on the word bar of soap, and also on the fact that bars in music are a segment of time corresponding to a specific number of beats, so it's a pun actually.