Because Eddard did not trust Catelyn enough at the time to tell her about a secret that could lead to murder of Jon and destruction of House Stark. Later the topic just never came up and both of them decided not to bring it up and enjoy a loving marital life. Nothing was to be gained except guaranteed security of Jon. Just a precautionary thing.
To understand this, you must first understand how Eddard Stark and Catelyn Tully got married. Since show did not cover those events, we need to rely on books instead.
Catelyn's betrothal to Brandon & Eddard's interest in Ashara Dayne
Catelyn Tully was initially betrothed to Eddard's elder brother Brandon who was heir to Winterfell (ADWD, Chapter 41, ACOK Chapter 45). Eddard himself was infatuated with Lady Ashara Dayne, sister of the legendary Ser Arthur Dayne (ASOS, Chapter 34). Ashara was considered a great beauty of her time. A very splendid depiction by Elena Maria Vacas can be seen on her page, here.
Brandon's Death and Robert's Rebellion
Fast forward, Rhaegar and Lyanna run away together when the Starks were on their way to Riverrun for wedding of Brandon and Catelyn. Brandon, hot headed and impulsive, was under the impression that Rhaegar abducted Lyanna. He rode to King's Landing with close friends and screamed for Prince Rhaegar to "Come out and die". Prince Rhaegar was not there, but mad King Aerys was. He imprisoned Brandon and summoned his father Lord Rickard Stark to King's Landing. Then he had both of them executed. Then he asked Lord Arryn to send him heads of his wards the young Lords Robert Baratheon and Eddard Stark. Jon Arryn instead called his banners because he loved those boys like his own sons and Robert's rebellion started. (AGOT Chapter 4, ACOK Chapter 55, AGOT chapter 2)
Eddard marries Catelyn
Always dutiful and responsible, Eddard set aside his own wishes for marriage and married a total stranger Catelyn Tully in place of his brother, to secure swords of House Tully for Robert's cause (AGOT, Chapter 6). He did not know her, he did not love her and he did not trust her. He did not even like her at the time, it was Ashara whom he liked.
He could not have married Ashara instead because:
- House Dayne was a minor House with less power as compared to House Tully. Rebels faced combined might of The Reach, Dorne and Crownlands. There was no telling which side Lannisters would go but seeing as Tywin was a childhood friend of Aerys II, He may have joined on side of Aerys too. So They sorely needed swords of the Lord Paramount of Riverlands to wage the war. Daynes used to be kings once, but those days were far gone.
- House Dayne was vassal of House Martell, who had already declared for King Aerys due to marriage between Princess Elia of Dorne and Prince Rhaegar Targaryen. Thus they were honor bound to follow their liege lord Prince Doran in the war, making them unable to help the rebels.
- Help from House Dayne would have been very little, if any. Had they joined forces with Rebels, they would be trapped between the loyalist forces of Tyrells and Martells who would at once move to fight the Daynes. That itself would put Ashara and her kin in great danger. Lord Dayne would have to be an utter idiot to agree to such an alliance.
After wedding and bedding Catelyn, Eddard went to war.
Battle of Bells happened where combined Forces of Eddard and his father in law saved the trapped Robert Baratheon.
Prince Rhaegar returned from South and died at Trident.
Since Robert was wounded in the battle, Eddard lead a quick charge towards King's Landing, only to find it had been conquered for Robert by the Lannisters. Eddard and Robert had a quarrel regarding the murders of Rhaegar's children but Robert only called them Dragonspawn. A fuming Eddard lead his men further south to fight rest of battles alone. He ended Siege of Storm's End first and then moved further south to Dorne where entire episode of Tower of Joy happened.
Eddard's return from ToJ
When Eddard got back with Jon, he knew he could not trust anyone especially after he saw Robert's reaction to murder of Rhaegar's children(AGOT, Chapter 12). He knew Robert would kill Jon as well if he so much got a whiff of who he was. So he decided to keep it a secret. His friend Lord Howland Reed did the same.
When Eddard got home, his lady wife arrived soon after, the woman he barely knew and thus did not trust enough to divulge such an important secret which would mean death of his sister's only son if the wrong people learned of it. Therefore, Eddard told her before returning to Winterfell that the babe was his bastard child. A lot of men fathered bastard children and such matters are private so no one was likely to pry into it especially when it's bastard of a man like Eddard who was known to be very private, shy and quiet.
Danger of being spied on
With time, Eddard came to love and trust Catelyn but he never divulged that info to her. He probably thought it best to let it be instead of bringing it up again. You never know who is listening in the castles especially with Varys in service of Robert. We know it was wise because Varys had spies in Winterfell and he learnt about the assassination attempt on Bran by Joff's catspaw despite Catelyn trying to keep it a secret.
Catelyn's attempts to learn the truth
Catelyn tried to get the information but Eddard was adamant. There were rumors that Ashara Dayne was the mother of the child so Catelyn decided to confront Eddard. Eddard got very stern with her and told her "Jon is my blood, that's all you need to know". Catelyn got scared of Ned for first and last time in their married life. After that Catelyn never brought up the topic again and Eddard did not either. (AGOT chapter 6)
Ashara Dayne Factor
It is also worth noting that after killing Arthur Dayne at Tower of Joy, Eddard went to Castle of Starfall first, seat of house Dayne. There he gave the ancestral Sword of House Dayne, named Dawn and carried by Ser Arthur Dayne at ToJ, to his(Eddard's, not Arthur's) apparent lover Ashara Dayne and gave her the news of her Brother's death. Mad with grief for her brother (and allegedly losing a child) and the fact that It was Eddard who killed Arthur, Ashara jumped from a tower into the sea and died. So it would make sense that Ned would do anything to avoid mention of Ashara Dayne as it brought back memories that he did not wish to recall ever again.
Ashara was a known alleged lover of Eddard1 who was also pregnant and gave birth to a child2 before her death, rumors started that Ashara Dayne was mother of Jon and she killed herself when Eddard took Jon away from her. Eddard did not deny or confirm these rumors but moved to quell them, especially in his own household. Eddard's weird reaction made many people believe that Ashara was Jon's mother. Apparently Eddard thought it best to give people the impression that Ashara must have been the mother.
Ashara's nephew Lord Edric Dayne met Arya and confirmed that Ashara was not the mother of Jon but he also confirmed that She and Eddard loved each other. (ASOS Chapter 39). Exact quote added because I loved that conversation:
“My father was Ser Arthur’s elder brother. Lady Ashara was my aunt. I
never knew her, though. She threw herself into the sea from atop the
Palestone Sword before I was born.”
“Why would she do that?” said Arya, startled.
Ned looked wary. Maybe he was afraid that she was going to throw
something at him. “Your lord father never spoke of her?” he said. “The
Lady Ashara Dayne, of Starfall?”
“No. Did he know her?”
“Before Robert was king. She met your father and his brothers at
Harrenhal, during the year of the false spring.”
“Oh.” Arya did not know what else to say. “Why did she jump in the
“Her heart was broken.”
Sansa would have sighed and shed a tear for true love, but Arya just
thought it was stupid. She couldn’t say that to Ned, though, not about
his own aunt. “Did someone break it?”
He hesitated. “Perhaps it’s not my place...”
He looked at her uncomfortably. “My aunt Allyria says Lady Ashara
and your father fell in love at Harrenhal -”
Catelyn was not a bad woman but it is too much to ask of a woman to endure a walking, talking reminder of her husband's infidelity, especially if you know that it wasn't a mere one night fling, the other woman was loved very much by your husband. She knew about Ashara Dayne, even though not for certainty, whom she saw as a ghost who was her rival for Eddard's love. She hated that Ashara's alleged son looked more Stark than her own Son Robb who looked like a Tully. She hated that Eddard loved Jon's mother so much that he would not abandon her son despite Cat's constant pleadings.
Thus she treated Jon with contempt and hatred as any medieval step mother would. As suggested by Gowenfawr, if Ned had told Catelyn, she would have been kind to Jon and everyone would have wondered what was actually at play there even if Varys did not manage to report the conversation in the first place.
Eddard took his vows very seriously and he promised his sister to keep Jon safe. He endured Jeering, mocking and confrontations with his wife but he never put Jon's security at risk by telling his true identity to anyone. Some things are better left buried.
EDIT: I was doing a re-read of AGOT today and found something which I had never thought of much importance until now. In AGOT Chapter 33 Eddard VIII, Eddard thinks this:
Lord Stannis shared the secret Jon Arryn had died for, he was certain
of it. The truth he sought might very well be waiting for him on the
ancient island fortress of House Targaryen. And when you have it,
what then? Some secrets are safer kept hidden. Some secrets are too
dangerous to share, even with those you love and trust.
It appears this is hinting towards why Eddard kept Catelyn in dark about Jon's parentage even after he came to love and trust her. This is why I love ASOIAF, on every re-read, you discover something new.
1 There is an alternate theory propelled by Barristan Selmy's memoirs of Harrenhal that it is possible that It was Brandon Stark, elder brother of Eddard, who "dishonored" Ashara Dayne and had the Harrenhal fling with her. It is, in any case, unproven as of now because Selmy uses the word Stark instead of recalling Ashara's lover by his name. Brandon Stark was however that sort of person, a playboy aristocrat. He had an alleged affair with Barbary Dustin as well despite his betrothal so it won't be beyond him to trick Ashara into sleeping with him by lying to her about his intents/feelings and then abandoning her. It is very uncharacteristic of Eddard Stark to "dishonor" a woman and then abandon her. As Robb does most things like Eddard Stark would do, we know he chose to risk his Kingdom and crown instead of "dishonoring" Jeyne Westerling, it may be an indication but as stated already, this is a theory. Canon sources still suggest that It was Eddard, not Brandon.
2. According to Barristan Selmy, Ashara's Child was a daughter who was dead at birth