How does valency change in a reaction?
Yes, valency can change, just like that. Some elements (in fact, most of them) can manifest different valencies; that's their nature. If you look again at this very reaction, you might notice that Fe is not the only element to change its valency here; S does the same. Reactions like this one are called redox reactions. There is a huge body of knowledge that explains what valencies (or rather, what oxidation states) an element can have, and which of them are more stable; the answer by @Raghav Gupta touches on that in more detail.

As to the number of protons (if you mean the protons in the element's nucleus), it has nothing to do with valency. Really, Fe contains 26 protons; is its valency 26? Absolutely not, it is 2 or 3. Also, the number of protons in an element can never be changed at all. If you change it, you'll get another element; also, that would be a nuclear reaction, a thing which is out of scope of chemistry textbooks.