Welcome to the forum
If you can give us a bit more information about them and your set up then that enables us to help more specifically.
Did you check both their sexes yourself to confirm they are definitely the same sex?
How old are they? (from 4 months of age they are teenagers (until 14 months old) and that is when hormones rise and unfortunately it is also the time when any incompatibility will come to light in piggies who were not properly matched - they can be ok together as babies when they are desperate for companionship but once the hormones start they become about hierarchy and dominance and suddenly they aren’t ok together).
How big is their cage? Two boars need 180x60cm
Do all hides have two exits? A single exit hide is a problem as one piggy is able to trap the other inside and that can be a flash point for fights; double exit tunnels means there is always a way out
When you say attack, do you mean a full on fight causing injuries?
If so then that sadly would mean their bond is broken and they would have to be permanently separated. There is no chance of reconciliation once a full fight has happened.
They would need to be kept in separate but side by side cages so they can still interact and have companionship between the bars but they could not share a cage again.
Moving piggies to a new environment will cause them to have to reestablish their bond. In well matched pairs this disruption is minimal but in pairs which are teenagers or may have an underlying dysfunction, then the reestablishing can bring those issues to the fore and potentially break the bond.
Reacting to group or territorial changes: Dominance and group establishment/re-establishment
Bonds In Trouble
Boars: Teenage, Bullying, Fighting, Fall-outs And What Next?