Switching a resistor by software
There are a couple ways of doing the termination with CAN (from AD application note AN1123): 



Here is one scheme that uses switched termination to a common mode level, using two smallish p-channel MOSFETs. Raising the gates to +5V turns off the termination. 



As an alternative, there are some pretty low-resistance analog switches available (a couple ohms or less) which  might simplify things but you'd have to analyze how well they'd do with ESD etc., and many won't handle even 5V. For example the TS5A3167.