Masters will negotiate the bus access. Only one master has access at a time, so the slave will not be confused.
There are two scenarios that can happen when both masters try to drive the bus:
1. They both want low state, this is fine, since there is no distinction at that point.
2. One master wants a low level and another one wants a high level. The master that wants a high level will sample a bus and see that it is driven low, it will assume there is a bus conflict and remove itself from the bus.
So, if two masters start at exactly the same time, the master that wants the bus to be high will lose to the master that wants it to be low. And the bus state in general remains consistent, since as far as the slave can see, it was always the way the winning master wanted it to be.
The other master will have to retry the access later.
In the unlikely scenario that two masters want exact same access at exact same time, it would also work fine. The slave would just see it as a single master and neither master would know that there is another master on the bus.