ROKO bed levelling sensor
I can't comment for the specific sensor you have, but in general, yes, if you plug something in backwards you have a chance of breaking it - and whatever you plug it into - permanently.

You might have gotten lucky, though - but short of testing the sensor to see whether it will work there is no way to find out.

Consider that these sensors are not made to be plugged directly into endstop connectors. The endstop connectors only provide 5V, whereas these sensors often require at least 6V to operate. Some people get lucky and have theirs work on only 5V, but it's not guaranteed to work. This might also be the cause why your sensor is not working, even if it's not broken. There are some special sensors out there that are rated to work at 5V, but you should check the operating voltage of your specific sensor.

If your sensor requires more than 5V to operate, then you should also be aware that the signal pin might output more than 5V, in which case, it should not be connected directly to the signal pin on the board (since anything over 5V might damage the board).

Finally, consider the possibility that neither orientation (backwards or not) is correct. Perhaps the order of the wires in the sensor's connector is different from that of the main board. Make sure that the pinout of your sensor matches the pinout of the connector on your board. These sensors usually have a slightly strange color coding where black is signal, blue is ground and brown is power.