Portrait Of Laura Moubray is described by the National Galleries Of Scotland as a "fine early work", and has been acquired by the galleries through the UK Government's Acceptance In Lieu scheme, which offsets inheritance tax bills and encourages art works to be kept in public collections rather than sold on the open market.
The tax offset by the acceptance of the Constable work is £105,000.
The scheme brings up to 10 items and collections to the Scottish collections annually.
Freud, who died in 2011, is considered one of the greatest painters of the last century. He once said: "I've always thought it was completely loopy for people to go on about portrait painters, English portrait painters, and not to have Constable among them."
The sitter's husband was Robert Moubray of Cockairny and Otterston, a deputy lieutenant of Fifeshire who lived between 1774 and 1848.
Constable, known more for his landscapes, is believed to have painted only about 100 portraits during his early career, of which about 50 survive.
The painting complements the galleries' existing holdings of the artist's work: the major landscape The Vale Of Dedham (1828) and the small sketch On The Stour (1830).
Freud is already represented in the collection of the National Galleries Of Scotland by a number of key works, which include Two Men (1988).
Michael Clarke, director of the Scottish National Gallery, said: "We are thrilled to receive this charming and intriguing picture.
"Lucian Freud had a very discerning eye and now our public will also be able to appreciate the qualities Freud found in Constable's rare and unusual portraits."
The Scottish National Gallery was one of Freud's favourite galleries.
Other English portraits in the galleries include significant works by Thomas Gainsborough, Sir Joshua Reynolds and Sir Thomas Lawrence.
The Acceptance In Lieu scheme is a reserved matter but "executive devolution" arrangements are in place to enable Scottish ministers to deal with cases in which there is a Scottish interest.
The scheme is administered across the UK by the Arts Council England.