It and other punctuation marks like commas were adapted directly from Western writing systems in 20th century.
Another interesting adaption was differentiating the gender neutral 3rd person pronoun 他. 他 became used purely for he/him with 她 and 它 added for she/her and it respectively, though all share the same pronunciation.
In contrast, the written Cantonese 3rd person pronoun 佢 retains its gender neutrality.
As to before all this, keep in mind even without punctuation it is possible to make a written statement be read as a question.
Contrast these two English sentences:
You have a pen / Do you have a pen
The same thing can be done in Chinese:
你有(you have)鋼筆(pen) / 你有鋼筆嗎(do you have a pen) / 你有沒有鋼筆 (do you have a pen)
The only time you really need punctuation is for a sentence like "You have a pen?", where a change in tone indicates an otherwise indicative statement is a question. The same thing can be done in Chinese languages.
Traditionally, Chinese writings did not formally use punctuation marks. Readers need to find out for themselves where sentences begin and end. Sometimes confusion and ambiguities arise. A famous example is "下雨天留客天留我不留", which can be interpreted in contradicting ways, depending on how you break the words in sentences. Ancient Chinese readers sometimes added symbols to help them read, but there were no formal rules on what the symbols should look like.
The punctuation marks we see in Chinese today were introduced in early 20th century, with the goal to make learning easier. The effort was led by intellectuals like Hu Shi, who was also influential in bringing about Simplified Chinese. The department of education formally introduced modern punctuation in 1920. Publishers began to print classic books with modern punctuation in the same year.
Contrary to popular belief, there actually was punctuation in ancient Chinese. This article in Chinese has some very ancient examples, though I don't see a question mark. See the last paragraph for some explanation.
According to Joseph Needham's Science and Civilisation in China Volume VII:1, p. 181:
It appears the first emergence of punctuation was roughly contemporary in China and Greece
but
By and large the vast majority of Literary Chinese texts were printed in unpunctuated editions until the 20th century. Punctuation was regarded as vulgar. The presumption was that those who deserved to understand these books would naturally be able to punctuate them properly. Literary Chinese was never a natural medium for popularisation, and the elitist nature of Chinese written culture has, in this instance, let to a refusal to make these texts more accessible through coherent punctuation.
According to An Encyclopaedia of Translation: Chinese-English, English-Chinese, punctuation as it is used today was gradually introduced alongside European texts in translation.
Instead of prefixes and suffixes, the Chinese language has many "particles," basically characters that serve to alter the meaning of a sentence in much the way that punctuation does in English. In ancient Chinese, characters such as 何 and 乎, within a certain context, would denote a question. Today, you have characters such as 吗, which is basically a question mark pronounced out loud, characters such as 哪, which literally mean "which one," and constructs such as 有没有. When taken in their context, they clearly turn statements into questions.