Why do taken men feel compelled to look at porn?

Not to generalize, but why do men in relationships (and women as well, for that matter) feel compelled to look up porn and other attractive women (or men) on social media while their significant other is away, even if the relationship is considerably solid?