From Lisbon airport

By train:
Take the Metro (~2€) or a taxi (about 8€) to Gare/Estação Oriente railway station (around a 5-minute ride). Trains run every hour from 6 am to 9 pm. The fastest service is provided by Alfa Pendular (˜23€ Turística class), which takes about 1,5 hours to Coimbra-B station, followed by Intercidades (inter-city service) (~19€ Turística class), which takes about 2 hours to the same station.

By bus:
Take either the metro or a taxi (9 € or more, depending on time of day) to the Sete Rios bus terminal. From the bus terminal, there are frequent Rede Expressos coach services to Coimbra which take about 2,5 hours (~13 €). The coach station in Coimbra (Estação Rodoviária RBL) is situated close to the city centre (10-15 minutes walk).

Train: Comboios de Portugal (CP):
Bus: Rede Expressos:

From Porto airport

The Francisco Sa Carneiro airport in Porto is 11 km away from the city. The Metro is connected to the airport. The direction to it is signposted throughout the airport, so just follow the signs and take Line E (Violeta) from the airport to the Campanhã railway station. Metro trains run about every 20 minutes from early morning until after midnight. The trip will take about 45 minutes and cost about 2€.
Two types of train services are available from the Campanhã railway station as well: Alfa Pendular service (fastest yet most expensive) and the Intercidades. The Alfa Pendular trains run almost every hour and take less than an hour to get to Coimbra-B. The second class single fare is ~17€. Intercidades takes slightly more than an hour and cost ~12€.

Train: Comboios de Portugal (CP):

Please note that both train services run to the Coimbra-B station, which is located on the edge of the city centre. To get to the city centre by train, you will have to get off the train at Coimbra-B station and either (a) take a taxi from there  (a 5-minute taxi ride) or (b) take a local train shuttle (free of charge with your AP or IC train ticket), which runs every 15-20 minutes from Coimbra-B to Coimbra-A. The Coimbra-A railway station is situated right in the centre of Coimbra.