2-3 hours before intercourse is ideal, as exercising too just before may leave you fatigued.