ended up having toUsed when someone ends up in an undesirable or unintended situation, often due to circumstances or someone else's actions. The broader pattern はめになる means “end up having to” or “be put in the position of.”
JA: 急な仕事が入って、休日に出勤するはめになった。
EN: A sudden job came up, and I ended up having to work on my day off.