Conditional Probabilities

There seems to be an error either in the question or your understanding of it. If the question indeed says

90% of the mails it marks as spam are indeed spam and 90% of spam mails are correctly labelled as spam,

this means \begin{equation} P(\textrm{spam} \mid \textrm{marked}) =0.9, P(\textrm{marked} \mid \textrm{spam}) = 0.9, \end{equation} and the question doesn't make much sense as the answer is stated directly in the question, while the official solution is wrong. However, I suspect the intended premises actually were something like

It marks 90 % of spam mails as spam, and 90 % of non-spam mails as not spam,

which translates to conditional probability statements as follows: \begin{equation} P(\textrm{marked} \mid \textrm{spam}) = 0.9, P(\neg\textrm{marked} \mid \neg \textrm{spam}) = 0.9. \end{equation}

In this case you can match the intended solution by using Bayes' theorem to compute \begin{equation} P(\textrm{spam} \mid \textrm{marked}) = \ldots = 0.5. \end{equation}

You say that '...90% of the mails marked is indeed spam'. That should probably be changed into '...90% of the mails that is spam is indeed marked'.

On base of$P\left[\text{spam}\right]=0.1$, $P\left[\text{marked}\mid\text{spam}\right]=0.9$ and $P\left[\text{marked}\mid\text{no spam}\right]=0.1$ we find:

$$P\left[\text{spam}\mid\text{marked}\right]=\frac{P\left[\text{spam}\wedge\text{marked}\right]}{P\left[\text{marked}\right]}=\frac{P\left[\text{marked}\mid\text{spam}\right]P\left[\text{spam}\right]}{P\left[\text{marked}\mid\text{spam}\right]P\left[\text{spam}\right]+P\left[\text{marked}\mid\text{no spam}\right]P\left[\text{no spam}\right]}=\frac{0.9\times0.1}{0.9\times0.1+0.1\times0.9}=\frac{1}{2}$$