All of the trains connecting Oporto and Lisbon stop at Coimbra- B; about 1h00 from Oporto and about 1h 45m from Lisbon. See the web page of the CP (Comboios de Portugal).
Coimbra is served by two major train services – ALFA – directly from LISBON (Sta. Apolónia Station, or Orient Station next to the airport) or PORTO (Campanhã Station) – and INTERCIDADES with direct links to Lisbon, Oporto and Braga.
From Oporto Airport you can take the Metro to Campanhã Railway Station. Check here.
From Lisbon Airport you can take the Metro to Oriente Railway Station. Check here.
Coimbra is served by two railway stations: COIMBRA A in the city centre and COIMBRA B in the north of the city. ALFA and INTERCIDADES stop at COIMBRA B. There are several link services from COIMBRA B to COIMBRA A (city centre) by train.
From Oporto airport take the highway A1 to Coimbra. More details here.
From Lisbon airport take the highway A1 to Coimbra. More details here.
Coimbra Airport Shuttle operates a door-to-door shared transfer between the Center of Portugal and both Lisbon and Oporto airports.
The Coimbra Airport Shuttle service offers numerous daily shuttles going to or departing from the airports.
You can find more detailed and interactive information here.