The Pharisees used a wide definition of sexual indecency in permitting divorce (Matthew 19:3), but a narrow definition in battling lust (5:27).
Jesus essentially says, “You have it backwards.”
He instead wants us to use a wide definition of sexual indecency in battling lust (5:28-30), but a narrow definition in permitting divorce (5:31-32, 19:4-12). One calls for a broad view of πορνεία (porneia), the other narrow.
“‘Fornication’ can cover a wide scope of sins, but Jesus intended to restrict and narrow the just grounds for divorce when He rejected the notion that one may put away his wife for just any reason (Matt. 19:3, 9).” (source)
Greg Bahnsen goes on to reason about the kind of sexual immorality that violates “essential commitments of the marriage covenant.”