Walk up to the vehicle you want and press the use key, which is E by default. That is the same key you have bound to Enter or Action, so if you have remapped your controls, use whatever you assigned there instead.
Once inside, the same key exits, and the vehicle's own controls take over — which vary between walkers, speeders and starfighters, so it is worth a moment in the first match to learn which key does what.