A BMW transmission that is stuck in park is a big problem, but fortunately there is a way you can release the transmission to get going again. You will then be able to drive the car, and if you leave the transmission in neutral you can start and stop the car as needed until you can get to a repair facility. If you're worried about the problem happening while you're away from home, make sure you have a screwdriver in the car so you can release the mechanism.
Slide your finger under the lip of the shifter cover, right at the "D" mark. Lift the shift cover firmly with your hand. Pop the cover off to reveal the shifter mechanism underneath.
Examine the underside of the cover and the inside of the mechanism for anything sticky that may have spilt inside. Many transmissions get stuck in park because the interlock that prevents the shifter from moving out of park when the brake is pressed becomes stuck in place with sticky soda or coffee. Clean off anything you find using the solvent cleaner and paper towels. Press the brake and try moving the shifter out of park.
Locate the small cam on the right side of the shift lever. Lift this up with the screwdriver to release the interlock. Lift the cam, press the brake and move the shifter to neutral. You can now start the car with the shifter in neutral. Take your BMW to a certified repair facility to have the problem checked out more thoroughly.
Make sure you apply the parking brake to keep the car from moving when it is in neutral. Use a small amount of solvent cleaner on the parts inside the shifter to prevent the solvent from dripping down into the area underneath. If you do not use and release the parking brake often, make sure it does not stick when you first apply it.