At present the traditional train route between Madrid and Lisbon is not operating.
There is a once daily service however, operating overnight:
Dept: Madrid (Chamartin) 22h45
Arriving: Entroncamento 06h37
There is a train departing:
Dept: Entroncamento 07h46
Arriving: Castelo Branco 10h01
There are no direct through bus services Madrid to Castelo Branco.
One would have to take a bus Madrid - Lisbon Sete Rios and then another bus Lisbon Sete Rios - Castelo Branco.