According to As Thousands Cheer: The Life of Irving Berlin: (with my censoring)
Like many self-taught musicians, he hit only the black keys, which were easier for his untrained hands to control. He called them "n****r keys," and the pianos he used, "n****r pianos," Both terms were standard Tin Pan Alley jargon. His use of these expressions, repugnant though they were, suggested his unconscious identification with untrained and intuitive black musicians. From N****r Mike's to n****r keys, Berlin cast his lot with black music.
Also see this video of Irving Berlin playing on only the black keys
So it seems that a concept of just playing the black keys did exist. The reference is referring to the 1910 time frame. But it was not by force that black keys were played.
There is similar information in a 1996 article in CommonQuest: The Magazine of Black- Jewish Relations:
some doubted he was altogether responsible for his musical ideas. A rumor persisted throughout the 1910s that a "little n****r boy" wrote his songs for him; others credited black ragtime pianist Lukie Johnson, a performer at N****r Mike's. Although Johnson disavowed authorship, the rumors were not altogether unfounded. Berlin had learned ragtime from Johnson, then retooled it for mainstream consumption. All his life Berlin composed solely on the black keys of the piano, or, as he called them, the "n****r keys." His defense of this musically illiterate method was telling: The "n****r keys are right there under your fingers." "N****r" music was somehow already his own. As a boy staying at the Bowery flophouses, Izzy had occasionally signed himself "Cooney." Ragtime is a musical hybrid in which a classic Euro-American bass is mocked and elaborated by an African-American syncopating treble; its very form, in other words, is a microcosm and a source of American pop art— the "low" sensibility parodying and reinventing the "high." Developing in the late nineteenth century among blacks in the cities of the Midwest and Southwest, ragtime served as an accompaniment to various black dances, many of which bore striking resemblances to their African prototypes...
(The diatonic scale can be heard by playing a C-scale on the piano; one uses all the white keys. The pentatonic scale, in contrast, involves playing only the five black keys of the C- scale). When Berlin expressed his fondness for the "n****r keys" he was not only marking an obvious affinity of color — black keys, black music — but showing his familiarity with African- American music.
Also, the 1840 The Musical World, Volume 13
The black keys of the pianoforte give the scale then in use, as a proof of which, many of the ancient Irish airs, such as " The rose-tree in full bearing," and several others, may be played by using only the black keys of the pianoforte.
So just playing the black keys was known, but was unrelated to slaves being forced to play that way.