How to replace a light fixture that has a 3-way light switch
Ok first you're going to have to take the cover plates off the two switches and take photos.

Chances are two of those wires are meant to be hooked together as the "traveler" between switches.  Or, perhaps, that one hot wire is power feed to this setup, you need send hot down some line (maybe the other black) for the circuit to work.  In that case one of the whites is neutral, the other is switched hot to the bulb.

You can see a bunch of wiring options for 3 way switches at https://www.easy-do-it-yourself-home-improvements.com/3-way-switch-wiring-diagram.html

Next time, take photo before!