A twin mattress will fit in a truck bed, but it might be a tight squeeze. You may need to remove the tailgate or fold down the back seats to make it fit.
It’s also worth noting that some trucks have a higher bed than others. If you’re not sure whether your truck can accommodate a twin mattress, it’s best to measure the bed and the mattress before you try to make them fit. Otherwise, you might end up being very disappointed.