The first thing to do would be to check all fuses. Sometimes a very random blown fuse can cause this. Also unhook the battery for one hour to reset all systems, and try a jump start if you have not just to be sure it isn't a battery issue. Also try locking/unlocking key drivers door a few times using the key in the door.
Assuming the fuses are good and the battery reset does not help, nor a jump or key in door, then there are a few other things that can cause this. While not all can be trouble-shooted at home, I hope this information will be helpful to you and yield a possible solution.
1) bad key - try another one (this is most common)
2) bad brake
light switch - make sure your brake lights work. If not, the switch is above the brake pedal.
3) shifter not fully in park (auto transmission only) - try moving it around a bit, try starting in both park and neutral
4) bad immobilizer (aka EWS or CAS) - nothing can be done, dealer equipment is required to fix. When this goes bad or out of alignment, the car does not get the proper signal that the correct key is present, and therefore, the car will not start and the starter will not be allowed to engage.
5) bad transmission position switch (auto transmission only, located on side of transmission, accessed from under car) - this is what signals the car that it is in neutral/park and is safe to start.
6) bad clutch switch (manual transmission only, located above clutch pedal) - this is what signals the car that the clutch is depressed and is safe to start.
7) dead starter/solenoid/relay - you would need to access the starter and test for the start signal to verify.
8) bad ignition switch/cylinder/start button - unlikely as you would generally not get all other functions / power to come on inside the car in that case
Of course, it could also always be something totally random like a wiring breakage or problem with the engine
control computer or other control module, but this is unlikely and hard to predict - and impossible to diagnose at home.
The best path forward will be to replicate the problem with the vehicle connected to a bmw scan tool to verify the cause if none of the simpler items above pan out.
Please let me know if you have further questions. Please do not forget to click a positive rating as this is the only way I receive credit for my answer, thank you. Best wishes with your vehicle.