Is it the same as in English? 'Obligatory' is when something is required because an authority has made it a stipulation and 'necessary' is when something is needed for a practical reason.
In French, those two words are in fact kind of similar, and can be interchanged most of the time.
But like in English, obligatoire is mostly used when there's some kind of authority behind it.
J'ai été dans l'obligation de m’arrêter lorsque les policiers me l'ont ordonné.
Here we couldn't have used J'étais dans la nécessité, because it was an order from the policemen.
Il est nécessaire d'avoir un ticket pour assister au concert.
Here you could also use Il est obligatoire d'avoir un ticket.
J'ai dans mon sac ton mon nécessaire de travail / voyage.
Nécessaire can also be use as a noun in this sentence, referring to what you need to do something.
To sum up, nécessaire is mostly used to talk about the need, and obligatoire for something that you have to do because there's some kind of authority behind it.