Oxycodone while pregnant.

Im considered high risk due to an autoimmune disease that could cause heart block in my baby but today I had the absolute worst pain imaginable. 10/10 on the pain scale because of a cyst in my vagina. I went to the birthing center and they prescribed me 5mg oxycodone. All I needed to hear was “oxy” to know I wasn’t taking that. I went to pick up the other pills i was prescribed and the guy was super confused as to why the prescribed me that and warned me about the risk of slow breathing and slow heart rate in the baby while on oxycodone. Why would they prescribe me this?