Prostitute could be a joke?
One of the problems with words is that you can look for the meaning in a dictionary, but as soon as you put it in a sentence the meaning changes, coloured by the words around it and the situation it is used in.
This means that the only answer to your question is "maybe..."
If your teacher was laughing when he said it, it was probably intended as a joke, but that doesn't mean you have to accept it as one. I would call it 'a joke in bad taste' and you are justified in feeling bad about it.