When Jack asks Gwendolen to marry him, he is unaware of any familial relationship between them. Jack's background is uncertain, as he knows nothing of his biological parents. He has been raised as an adopted son by Mr. Thomas Cardew, who found him as an infant in a handbag at the train station and christened him after the destination on his ticket at the time, "Worthing." Yet, it is precisely the difference in Jack's and Gwendolen's family connections that Lady Bracknell cites as a reason for them not to get married.
You can hardly imagine that I and Lord Bracknell would dream of allowing our only daughter—a girl brought up with the utmost care—to marry into a cloak-room, and form an alliance with a parcel? Good morning, Mr. Worthing!
In the 1800s, marrying someone of equal social stature was incredibly important. So, when Jack is revealed at the end of the play to be Algernon's brother, making him Gwendolen's cousin, Lady Bracknell is more accepting of their engagement, as he now has the same social class and background as her daughter. This was thought to be more "proper."
In fact, in the 1800s, and long before then, cousins marrying each other was an incredibly common practice. We see this time and again in literature of the time, such as in Pride and Prejudice , in which Mr. Collins asks Lizzy Bennet to marry him, even while calling her "cousin Elizabeth" in his proposal....
Edgar Allan Poe even married his own first cousin when she was just thirteen.
Marrying your own cousin was thought to keep wealth within bloodlines and strengthen a family's stature and genetic purity. In addition, for anyone not living in an urban area, there simply weren't that many people around, and many of the people who lived in your town were likely part of your biological family.
Later in the 1800s, travel among rural areas became more easily accessible and there was more scientific evidence and awareness of the birth defects that occurred in the children of incestuous marriages. This resulted in a shift away from the practice of cousins marrying each other, and now, it is banned in many countries.
However, it's possible that Wilde intends us to be aware of the incestuous nature of Jack and Gwendolen's marriage. His play was written about twenty years after the practice of marrying cousins started being called into question, and as the entire play is a satire of the trivialities and manners of the upper classes, he may be highlighting the absurdity of Lady Bracknell's disapproval of Jack and Gwendolen's marriage when they are of different social statuses only to later approve it when she discovers they are cousins.