In American English it usually means a place where movies are shown. (This would be called a cinema in British English). In British English theatre means a place where live plays are performed. (This would be called a stage theater in America).
Theater or Theatre can also mean the business of putting on plays. An actor might say "I am in the theatre business.", or a writer might say "I write for the theatre" meaning that they write plays rather than movies or TV shows.
The first people to perform plays were the Ancient Greeks. Some famous writers from then include Aristophanes and Sophocles. They divided plays into two kinds: comedy which are funny and in which the good characters usually end up happier than they were, and tragedy which were usually sad and the good characters suffer or end up worse than they were. Plays are pften still divided into these two types today.
In Europe there was almost no theater until the Middle Ages. Then the Christian church began to use theater as a way of telling the stories from the Bible to people who did not know how to read. They wrote Mystery Plays, where each part of the Bible story would be a play put on by a different group of people. In the sixteenth century there were groups of actors who would tour round the country performing plays for entertainment. These plays were called Commedia dell'arte, and different stories would be created around the same group of characters. Often the exact lines would be made up by the actors for each performance.
At the end of the sixteenth century the travelling actors began to perform in fixed theatre buildings. They also began to have writers write down their lines instead of making them up. This was the period in which William Shakespeare wrote. At that time, in England, women were not allowed to perform, and male actors would play female characters.