Deductions & credits

Later in publication 502 it says,

Generally, you can't include in medical expenses current payments for medical care (including medical insurance) to be provided substantially beyond the end of the year.

 

The IRS does not define "substantially beyond" the end of the year.

 

The idea is that you can't deduct pre-paid medical care too far in advance, and I think (but am not sure) that the IRS is targeting concierge medical arrangements and other situations where you are not ill but pay in advance in case you get ill.

 

Here, you have a medical need in 2024 (IVF is deductible in general), and your actual treatment started in January 2025 (which is not "substantially" past the end of 2024).  So I would say you are find to deduct in 2024.