We investigated effects of early and later life housing on attention bias, as an indicator of affective state, in pigs differing in coping style [reactive (LR) vs. proactive (HR)]. Pigs (n = 128) in barren or enriched housing from birth (B1 vs. E1) that experienced either a switch in housing at 7 weeks of age or not (creating B1B2, B1E2, E1E2, and E1B2 treatments), were studied in a 180-s attention bias test at 11 weeks. Pigs exposed to a 10-s-auditory-and-sudden-motion threat in the test arena paid more attention to the location of the threat, were more vigilant, showed less eating, more walking and were more likely to utter high-pitched vocalisations than non-threat pigs. During threat presence, HR pigs from post-switch enriched housing (E2-HR, i.e., B1E2 + E1E2) showed more vigilance but less exploration than others. After threat removal, no effects were found on time spent paying attention to the threat, vigilance, and eating, but E2-HR pigs paid attention to the threat more frequently, were more likely to utter high-pitched vocalisations and walked more compared to (part of) other groups, suggesting the most negative affective state in these animals. E2 pigs grunted more than B2 pigs. Thus, current housing, but not early life housing, affected behaviour in a personality-dependent manner in this attention bias test. Housing effects were opposite to expectation, possibly due to the short-term effect of the relative contrast between the home pens of the pigs and the test room. This potentially overruled putative long-term effects of environmental conditions on attention bias.