Yes you can open the microwave door before it beeps or before the microwave has finished cooking.
I do this all the time when I need to check on the doneness of some food or to see how much longer the food needs thawed out.
There's no harm in opening the door of the microwave before it shuts off or before it beeps as if the microwave is working properly the microwave should shut off when the door is opened and then when you shut the door again you can just restart the microwave to finish defrosting the food or finish cooking the food.
The reason people leave their microwave door open is to help dry out the inside of the microwave.
When you cook something in the microwave that produces steam the inside of the microwave gets wet with the steam which can cause rust inside the microwave.
So by leaving the microwave door open for an hour or so after cooking in the microwave it allows the steam and the moisture to escape and dry out the microwave.
This prevents the microwave insides from rusting.
If you cook things that steam in the microwave it's advisable to leave the microwave door open for 30 minutes or so to allow the steam to escape from the microwave.
Your microwave will usually last longer if you do leave the microwave door open for a bit after cooking as it won't rust out as quickly as it would if the door was left closed and the steam was trapped inside the microwave.
You can also open the door of the microwave before the microwave beeps or before the timer on the microwave has completed.
I do this all the time to check if the food still needs defrosted some more or to check to see if the food needs cooked some more.