What does 头上养马 mean?
I feel this phrase is a metaphor for 戴绿帽子(wear green hats), which means a man has become a cuckold because his wife cheats on him and sleeps with other men. (This is also why Chinese men usually don't wear green hats and would get impressed when they first see people celebrating the St. Patrick's Day.)

她给她老公戴了绿帽子。
她让她老公戴了绿帽子。
(She made her husband wear green hats.) 
She has cuckolded her husband.

Or

他戴绿帽子了。
(He wears green hats.)
His wife has cheated on him.

戴绿帽子 is a euphemism for 当王八(being a tortoise), because the head of a tortoise is dark green, and wearing green hats makes a man look like a tortoise. 当王八 is a cursing and scoffing way of expressing that someone has become a cuckold:

她让她老公当王八了。
(She made her husband a tortoise.) 
She cheated on her husband.

Many other expressions can be used as indirect ways to say 当王八, including 被绿了(be greened) and 戴绿帽子。In you question, because 养马(keep horses) needs grass, 在头上养马(keep horses on his head) implies that one's head is full of green grass, the same looking as in wearing a green hat. For each of your sentences:


让他头上养马
Let him become a cuckold.
I'll cheat on him. (if spoken by his wife)




那（他）怎么还敢在她头上养马？
How dare he to cheat on her?


Although the phrases are only used on men (saying a women becomes a tortoise or wears green hats really doesn't make sense, because 当王八 is only for men.), nowadays people generalize some derivative terms such as 被绿了 also for women.


敢接受莫可可的人，必须得有在头上养马的觉悟。
Those who accept 莫可可 as girl friend/wife would have to prepare to be a cuckold.




你是想在劳资头上养马吗！？
You wanna cheat on me?