I say that the Old Testament laws were meant to set Israel apart from the sinful, hedonistic, heathen pagan folks around them at that time. The world did not have a proper disposition yet to receive God's Word. Israel was God's shining beacon of hope.
The people of Israel had fallen away from God's disciplines, Word, teachings, and admonitions already by the time The Law was given, most notoriously they sinned in the desert in a heinous manner.
God knew Israel's heart, and He knew a strict, tight, focused discipline would be needed. They were a stiff-necked people! Some of the laws, imho, were to keep a sense of discipline, focus, and a feeling of being set-apart, as well as some healthy guidelines, others were permanent moral truths. "Homosexuality" or same-sex attraction, is an immoral act, period. We no longer say they should be executed like in days of old. Same thing with disrespectful teens who talk back to their parents. In the time of Moses, heads were gonna roll for such disrespect, rudeness, and brash talk! Nowdays, of course not, different types of punishments.
When atheists and skeptics try to invoke, "gee, you hate gays, but I get you eat pork!" type arguments, they just don't understand that the Mosaic Law had these different facets to it---discipline in the desert and being set apart, purified and focused, and some being morally eternal truths.
Ritually purification, women not being able to worship or come near anyone during menstruation, straining the gnat, circumcision, these were all either health issues for the time or discipline, not eternal truth. Sodomy is always sinful.