Of course, you should have a six year old dog completely checked out for medical problems. However, this is probably due to the way the dog was kept before you got her. She was probably kept in a crate without the opportunity to go out when she needed to defecate or urinate. Once a dog loses her natural instinct to not soil her bed it is very difficult to overcome.
A dog like this needs to be accommodated by a small yard when you are away, with adequate shelter and water. An animal behaviorist or an animal communicator may help, but I would advise not to have high expectations of this dog. She has gone through a lot already, it would be best to accommodate to her!