There is no difference between "the girl" and "the girl". There is a difference between "change" and "change". The first means something like alter or transform. The second means something like trade or replace.
That being said, I find it more natural to mark that difference by changing the number of the direct object. I would phrase that sentiment in this way:
If you can't change the girl, change girls.
Social implication aside, there's nothing wrong with the original sentence. The second sense of "change" doesn't require a plural object. The singular is common enough in phrases like "change the light bulb", despite the fact that there must be at least two bulbs involved in that exchange.
Without context, the original sentence could mean either:
When you can't transform the girl, replace her.
or
When you can't replace the girl, transform her.
Unlike my paraphrasing, there is nothing in the original to show which sense of "change" belongs in each place. The only thing that marks that there are two senses of "change" in that sentence is the contrast between them. There have to be separate senses for one to still be possible while the other is impossible.
I assume that the original means "if you can't transform her, replace her" because there are plenty of fish in the sea but a leopard can't change its spots.