Gay marriage and abortion: Why are there different laws in Northern Ireland?

Why do different rules apply in Northern Ireland when it comes to abortion and same-sex marriage?

Source