Maegor wasn't infertile per se. He had children, it was just that most of the children were deformed and none survived birth.
Looking back at his parents, it seems like all three conquerors had fertility issues.
Aegon I was 27 when he conquered Westeros whereas Visenya was 28 and Rhaenys was 25. It is unclear when did he marry his sisters but given that by Westerosi standards, when a woman has her first period she is considered fit for marriage, the estimate would be that he married Visenya when she was 12-15, making Aegon 11-14 and he presumably took Rhaenys to wife the next year. That would make their pre-conquest married life almost 13-16 years long.
That first decade (Or almost two decades) was barren for House Targaryen. Aegon and Rhaenys only managed to have one child, Aenys who was born in 7 AC when his father was 34 and his mother was 32. People whispered that Aegon couldn't have sired such a son because of Aenys' frail health and Rhaenys' lifestyle but there's no proof about that. Nobody ever accused Visenya of infidelity to her Brother and King who gave birth to her only child Maegor in 11 AC when she was 39, at which point Aegon had nearly given up all hopes of any second son.
Sons of the Dragon
Aenys went on to marry Alyssa Velaryon and was blessed with plenty of sons and daughters. Maegor on the other hand seem to have inherited whatever fertility issues plagued his parents and their sister. He married Lady Ceryse Hightower on suggestion of her uncle the High Septon but the wedding remained childless even though Maegor was sure he made a son with his wife on the very first night.
Frustrated with perceived infertility of his wife, Maegor took another wife, the Lady Alys Harroway. The marriage incurred the wrath of both the Crown and the High Septon and Maegor was sentenced to exile. This wedding remained childless as well.
After his return and ascension to the Throne, Maegor took another wife, the rumoured sorceress Tyanna of Pentos and reconciled with his first wife Ceryse Hightower as well. Despite having three wives, the King remained childless even though he tried vigorously. A year later Queen Alys became pregnant but the child she bore prematurely was a deformed monstrosity and dead at birth. Queen Tyanna who served as his master of Whisperers confided to him that the Child was not his (Maegor was already suspicious that he couldn't have sired that monster) but rather a bastard of Queen Alys who was so desperate to give the King a son that she slept with other men of proven fertility on behest of her father Lord Harroway of Harrenhal. The King had that house wiped out, root and stem. In the meanwhile Queen Ceryse suddenly fell ill and died as well.
Left only with Queen Tyanna, the King stopped sleeping with her after a time and started looking for other brides. This time the King took three brides of proven fertility, Jeyne Westerling, Elinor Costayne and Princess Rhaena Targaryen; The black brides. Within months Queens Elinor and Jeyne were pregnant. But the same episode was repeated again, Queen Jeyne went into labour 3 months early and gave birth to another dead monstrosity and died herself soon afterwards. Maegor now began to suspect that the Pentoshi Sorceress had something to do with the deformed births. She confessed after her arrest and promised that Elinor would give birth to another dead monster (Which was fulfilled two months later when she gave birth to a dead child with wings and no eyes).
Since you ask for Theories, there was one theory that Balerion carried some sort of curse (Something similar to nuclear radiations) being the last survivor of the Doom (Even though he left Valyria before the Doom). All the people who rode Balerion seem to have had fertility issues.
- Aegon the Conqueror sired just two sons despite having two wives. And those two took a long time to conceive too.
- Maegor the Cruel never sired a living child.
- Aerea Targaryen never lived long enough to marry and bear children so she doesn't count.
- King Viserys had just one living daughter from his first marriage. His son from Lady Aemma Arryn died in infancy. Balerion died after the first year of his marriage to Lady Aemma but the situation remained same. The King never claimed another dragon and had four children from his second wife.
But it is a long stretch if you ask me and should not be taken seriously.
It is evident that Maegor had some fertility issues. It is very possible that his wife Ceryse Hightower was barren herself since she never conceived herself. Lady Alys did conceive but she gave birth to an eye-less dead child which Tyanna used to cast her down and become the Sole Queen. Given how Maegor continued to have such children, we can safely assume that the reports about Alys' infidelity were calumnies concocted by Tyanna for her own ambitions.
But given how quickly two out of three Black brides became pregnant, we can assume that Maegor's fertility problems weren't all that severe. He was able to impregnate a woman alright but somehow his wives kept going into labour early and giving birth to deformed, twisted children who never lived. It is very possible that Tyanna was behind the premature labour and consequent deaths along with the twisted features of the children.
We must note of course that Maegor is not the only Targaryen who had deformed children with no eyes, wings etc. Daemon Targaryen had a similar child with his first wife Lady Laena Velaryon and once again with his second wife Queen Rhaenyra Targaryen. Then we have Daenerys' child with Khal Drogo who was also born dead, scaled and with wings after being poisoned in womb by Mirri Maaz Durr. Daenerys' example gives credence to the claim that Tyanna was responsible for the royal miscarriages.
In conclusion it seems like:
- Maegor may have had some minor issues in impregnating his consorts.
- Tyanna may have had used sorcery to kill the children of other Queens either to consolidate her position in the court or out of jealousy since she obviously never became pregnant.