Why are the civilly married not allowed confession in the Catholic Church? Why are the civilly married not allowed confession in the Catholic Church? 

Is there any guide or law about this?
You can go to confession but you may not receive absolution


  Can.  1055 §1. The matrimonial covenant, by which a man and a woman
  establish between themselves a partnership of the whole of life and
  which is ordered by its nature to the good of the spouses and the
  procreation and education of offspring, has been raised by Christ the
  Lord to the dignity of a sacrament between the baptized.
  
  §2. For this reason, a valid matrimonial contract cannot exist between
  the baptized without it being by that fact a sacrament.


A civil marriage is not a sacramental marriage.  (That is definitional). 
However... 


  ... a civil marriage would be valid
   1. if neither of the parties is Catholic  (at which point your question is non-applicable)
   2. if at least one of the parties is Catholic and he obtains a dispensation from canonical form (i.e., the provisions of Canon 1108) 
    In other words, Canon 1108 applies only to Catholics, and it can be dispensed with on a case-by-case basis.  


The above points offered by @AthanasiusofAlex, and accepted.  


  Can.  1108 §1. Only those marriages are valid which are contracted
  before the local ordinary, pastor, or a priest or deacon delegated by
  either of them, who assist, and before two witnesses according to the
  rules expressed in the following canons and without prejudice to the
  exceptions mentioned in cann. ⇒ 144, ⇒ 1112, §1, ⇒ 1116, and ⇒ 1127,
  §§1-2.


Understanding the sacrament of penance and reconciliation (confession)

Here's the problem with participating in the sacrament of penance and reconciliation while living in sin (in the eyes of the church):   


During the process of confession the penitent resolves to avoid sin
and the near occasion of sin.
If the intent is to go home and resume living in sin, then the person
so confessing has just lied to God during the confession.  Catch-22,
just committed another mortal sin.  


Getting on to technicalities now ... 


  ... if someone comes to confession and resolves to live from then on according to the Gospel (i.e., to live in continence until his marriage irregularity can be resolved), then he can certainly receive absolution. He can receive absolution even if he foresees that he will fall into temptation (but has nevertheless resolved to do the right thing in that moment).  


(Credit to @AthanasiusOfAlex)   


  VII. The Acts of the Penitent
  CCC 1450 "Penance requires . . . the sinner to endure all things
  willingly, be contrite of heart, confess with the lips, and practice
  complete humility and fruitful satisfaction."  
  
  Contrition
  CCC 1451 Among the penitent's acts contrition occupies first place.
  Contrition is "sorrow of the soul and detestation for the sin
  committed, together with the resolution not to sin again."   


Confession doesn't happen in a vacuum.  What is the penitent's intention?

If the person (or the couple) goes to confession, and resolves to no longer live in sin it doesn't end there.  The couple, with some help from the pastor, can work on convalidating their marriage.  During the process of convalidation (getting the marriage recognized as sacramental) the sacrament of penance and reconciliation is typically received as part of the process.   


  convalidation. In Roman Catholic canon law, the making of a putative
  marriage valid following the removal of some impediment.  A ceremony in
  which a marriage, such as a civil marriage, is made recognized by the
  church. 


By recognized it means that the church recognizes the marriage as being sacramental.  


  CCC 1622 "Inasmuch as it is a sacramental action of sanctification, the
  liturgical celebration of marriage . . . must be, per se, valid,
  worthy, and fruitful."  It is therefore appropriate for the bride
  and groom to prepare themselves for the celebration of their marriage
  by receiving the sacrament of penance.       


Convalidation covers a wide variety of situations, and is handled on a case by case basis.     


  Can.  1160 A marriage which is null because of defect of form must be
  contracted anew in canonical form in order to become valid, without
  prejudice to the prescript of ⇒ can. 1127, §2.  


A defect of form may be found even if the two in the marriage are committed to each other and otherwise behave as a validly married couple.  (See exception 1 up at the top).  You can't make a general rule about that, as each case is taken on its own merits.  Work with the pastor/local diocese is required.   


  CCC 1623 In the Latin Church, it is ordinarily understood that the
  spouses, as ministers of Christ's grace, mutually confer upon each
  other the sacrament of Matrimony by expressing their consent before
  the Church.