Unfortunately, you will need to make 2 separate purchases. You will need to buy a BART ticket at SFO and then get off at the Millbrae station. Proceed downstairs and where you will find the CalTrain ticket machine and then purchase a ticket there, whose fares are based on how many zones you will be travelling between. There are no CalTrain kiosks that I have seen at SFO.
Also, double check on the BART schedule on getting to Millbrae. You may actually need to make a transfer at the San Bruno. It's an easy transfer, just cross the platform and wait for a Millbrae bound train, but kind of silly if you think about it.