To evaluate the effect of different housing systems on sow behavior, 80 gilts were randomly allocated at puberty to four treatments: i) sow stall in gestation followed by farrowing crate (SC), ii) group housing with individual feeding in gestation followed by farrowing crate (GC), iii) ESF (Electronic Sow Feeding) system in gestation followed by farrowing crate (EC), and iv) ESF system followed by group farrowing pen (EG). Behavioral observations were carried out on a total of 16 animals per treatment at the following stages: first day of allocation to housing treatment, day of service, 80 days after service, 109 days after service on entry to farrowing accommodation, 24 h before farrowing, day of farrowing, 14, 27 and 28 days after farrowing, at weaning. On each occasion, individual animals were observed for a 24 period with one minute time sampling. There were significant differences (p<0.001) between stages of the reproductive cycle for all the behavior patterns in all treatments. On the first day in experimental housing treatments, sows spent more time rooting and dog-sitting. Activity and investigatory behavior decreased as pregnancy progressed. An activity peak was apparent just before farrowing, followed by a high level of inactivity on the day of farrowing. Time spent active, eating and drinking increased as lactation progressed, and greatest activity and locomotion was seen immediately following weaning. There were significant differences between housing treatments (p<0.01 ) for standing, moving, eating, drinking, dog-sitting and lying. During pregnancy SC sows spent more time standing, rooting, drinking and dog sitting, while EC sows spent less time rooting and drinking and more time lying. During lactation, GC sows spent more time standing, moving and eating, less time dog sitting and lateral lying. Nursing frequency was reduced in GC sows (p<0.001). The maternal and piglet behaviors were influenced strongly by environment during lactation. However, it was also shown that previous housing history can influence the maternal behavior in the pre-farrowing stage and during early lactation.