Exactly what you should have done. The biggest thing college does for you is get you ready for the real world. You are going to have plenty of times the rest of your life where you are going to have to make decisions between things you want to do, vs things you need to do. Then, YOU will have to deal with the consequences. This was no different. It's harsh, but at the end of the day, this professor teaches many students. To him, more than likely your just another number. You got a 50, when he could have easily given you a 0.
Do you think if your brother, whom is in the military, had to be somewhere for the military, and you popped up he could just drop his responsibility, and he not be reprimanded? 
You got a B instead of an A,

. If it's that big of a deal to you, make sure you learn from it.