means that
when overcoming a rival proves impractical, joining forces or adapting to their position may be a more effective strategy.
The saying “If you can't beat them, join them” can be used when if someone is too strong for you to defeat, better to be on his side.