When the previews for Episode II: Attack of the Clones stated that Jedi cannot have relationships, many fans were understandably confused. Star Wars had been around for 25 years at that point, and no one had ever heard of such a thing. Jedi in the Expanded Universe had no problems with marriage and family. Even Ki-Adi-Mundi, a Jedi in the Prequel trilogy, was married in the Expanded Universe.
Suddenly forbidding romance in the Jedi Order seemed like merely a cheap way to add drama to the storyline. Anakin and Padmé can't just have a romance; it must be a secret, angsty romance. As the story progressed, however, another explanation came to light. Perhaps the strict structure and rules of the Prequel-era Jedi Order are not a good thing after all. Perhaps, by not allowing Anakin to love, they are ultimately responsible for his fall to the dark side.
The Jedi Order forbids romance. This is not an inherently bad thing. Everyone knows how finding a boyfriend or girlfriend in college ate up all your study time -- imagine if you weren't just studying how to pass English Lit and then promptly forget all the books you read, but how to save the universe from evil. Like a religious order that requires its members to remain celibate, the Jedi Order saw romance, marriage, and family as a distraction from one's studies and duties.
But there's an important distinction: members of a celibate religious order are generally able to renounce their order and walk away at any time. Technically, Jedi can leave the Order, and some have. But the Jedi Order doesn't just forbid romance; it forbids all attachment. The Jedi take Force-sensitive children from their homes and families and raise them in a temple, training them from a very young age. The Jedi Order is the only family they know.
Jedi who are exceptions to this rule will find it easier to walk away. Count Dooku, for example, was a member of a noble family. He knew his heritage; he knew that he would have a life ready for him outside the Jedi Order. How many Jedi could say that? Most Jedi cannot make a meaningful decision to stay in the Jedi Order or leave. They are brought in when they are too young to consent and have every outside resource taken away from them.
Anakin & Padmé
Anakin Skywalker is an unusual case. He did not being his Jedi training until the age of 9; "too old," according to Yoda. The Jedi Council made an exception because of his extraordinary potential: he had the highest recorded midi-chlorian count and was possibly even the Chosen One prophesied to bring balance to the Force. Anakin did have a connection to the Jedi Order, but it seems to be more an attachment to his master than a loyalty to the Order as a whole.
Could Anakin have left the Jedi Order? Probably. He may not have had anything to return to, with his past as a slave on Tatooine, but he had talents outside of being a Jedi, as well as a relationship with a woman of great status and influence.
But what would have happened then? Anakin would still be volatile, acting impulsively on his emotions. Outside of the Jedi Order, however, he would have had no one to even try to hold him back. He probably would have become even more vulnerable to manipulation by Chancellor Palpatine. And he certainly would have still given anything to try and prevent Padmé's death.
What if the Jedi Order had allowed attachment? It certainly worked for the Jedi before and after. But the Jedi Order we see in the Prequels is one that has become lazy. Instead of looking at what is best for each individual Jedi student -- as masters could do for their apprentices before the Order became so centralized -- they came to rely too heavily on rules and regulations.
The Jedi Order is right to believe that attachment can be dangerous. This idea is present even in the Original Trilogy; in Return of the Jedi, for example, Luke's thoughts of his sister betray her to Darth Vader, causing Luke to attack in anger. But feeling attachment, whether one acts on it or not, is a natural impulse. Some Jedi may not feel a need for attachment, and others simply may not wish to form attachments; but those who do should be taught how to handle them.
The primary motivation for banning attachments, it seems, is the worry that fear of loss will drive Jedi to the dark side. This is precisely what happened to Anakin; unable to accept the idea that Padmé might die, he was willing to do evil in order to save her. But what if, instead of banning attachment, the Jedi Order taught its students that loss and grief were a normal part of life, and how to deal with that in the context of being a Jedi?
The Jedi Council already knew that Anakin was vulnerable. Obi-Wan Kenobi almost certainly knew that Anakin was having a relationship, but developed a "don't ask, don't tell" policy, too uncomfortable to discuss the situation and perhaps offer actual help. If the Jedi Order had allowed attachments, this young Jedi in dire need of emotional support could have come to them with his problems. The Jedi Order should have seen the weaknesses in their rules and realized that a breakdown like Anakin's was ultimately inevitable.