My husband was self employed for 5 years and filed taxes for those 5 years, but did not pay his social security taxes. Is there a way to pay them retroactively?
Well, first off your husband would need to have had a net profit of at least $400 in one or more of those years to owe self-employment (i.e. Social Security) taxes. If he didn't, he couldn't pay self-employment taxes on a voluntary basis in order to earn Social Security credits.
If your husband didn't report a self-employment profit and he actually did have a profit in any of the years in question, then he could file amended tax returns for those years. But, he could only potentially get Social Security credits for the years 2016-2018. Credit for any earlier tax years would be barred by the Statute of Limitations, which limits credit for newly reported earnings to tax years that ended within 3 years, 3 months and 15 days of the filing date of the amended return.