Since it's not public yet, you can only buy it in the secondary market. This means that you only get access to SpaceX stock from people who already own it (basically the employees).
There's a platform called EquityZen which links people like you to people who own stock through an organized / structured market (ie. available only for a short period of time). SpaceX is not there now, but that's your best shot of ever getting SpaceX stock when they're not public.
As of this writing, other equally commendable companies you can invest on is Palantir and ZocDoc, which, by the way, is under SpaceX's VC (Founder's Fund).
Edit (3/4/15): As an update, it's available now.Edit 2 (3/25/15): To note, you must be an accredited investor to be able to put money into these companies.
You might also like: