Yes, it's called a "taa' marbuTa" and it shows what words are feminine. As your vocabulary grows, you will learn that there are exceptions, of course. Not every feminine word ends with a "taa' marbuTa", and there are some masculine words with one.

In your sentence the word هذا is subject (i.e. about which we are talking about) and the word معلم is predicate (i.e. a part of a sentence which expresses what is said about the subject).

In arabic, when we make sentences then we use subject and predicate of the same gender. In your first example هذا is masculine therefore we have to use masculine predicate معلم. Same is the case with your second sentence.