If Onan was struck down for wasting his seed (cf. Gen. 38:9), why is it okay for a married couple practicing natural family planning to have relations during the wife's infertile time? Isn't that wasting the man's seed?

Onan spilled his semen on the ground for the purpose of making the act sterile. His sin was not the waste of semen—semen is often "wasted" in the sense that, during relations, its presence does not always result in pregnancy. Onan’s sin was acting in such a way that intentionally sterilized the act. This is very different from Natural Family Planning (NFP), which never attempts to render an act sterile—every act remains open to the possibility of procreation. NFP simply seeks to regulate pregnancy by observing abstinence during the woman’s fertile period.