The best time is your Medigap Open Enrollment Period. It lasts 6 months and starts the first month you are both 65 or older and enrolled in Medicare Part B.
During it, an insurance company cannot refuse to sell you any Medigap policy it offers or charge you more because of your health.
If you apply after this period, the company may use medical underwriting unless you qualify for a guaranteed issue right. That means you could be charged more or turned down based on your health.
If you have Medicare before 65 because of a disability or ESRD, you get a Medigap Open Enrollment Period when you turn 65.