You can generally include medical expenses you pay for yourself, as well as those you pay for someone who was your spouse or your dependent either when the services were provided or when you paid for them. There are different rules for decedents and for individuals who are the subject of multiple support agreements.
Go to IRS Publication 17 Your Federal Income Tax (For Individuals) for more information.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the webpage or document at the time it is accessed.